summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaciej Skrocki <maciej.skrocki@intel.com>2017-08-18 15:43:21 -0700
committerRoss Brattain <ross.b.brattain@intel.com>2017-08-24 12:42:53 -0700
commit42e59b19264a8a31650d2a111b79d932accd8e4e (patch)
tree86b26608fefd5467bab75e9520a5037a768c03eb
parent2a5189826106cee5bbbcc35df53abc4002c9d47f (diff)
Standardized TRex client library path
- path should be defined via TREX_CLIENT_LIB environmental variable e.g. TREX_CLIENT_LIB=/opt/trex_client/stl - refactored unit tests Change-Id: I18767e48daf774432c010f1b88d18a4f0ee4e156 Signed-off-by: Maciej Skrocki <maciej.skrocki@intel.com> Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
-rw-r--r--docs/testing/user/userguide/14-nsb_installation.rst3
-rw-r--r--etc/yardstick/yardstick.conf.sample1
-rwxr-xr-xnsb_setup.sh6
-rw-r--r--tests/unit/__init__.py76
-rw-r--r--tests/unit/benchmark/runner/test_search.py63
-rw-r--r--tests/unit/benchmark/scenarios/networking/test_vnf_generic.py60
-rw-r--r--tests/unit/network_services/traffic_profile/test_fixed.py61
-rw-r--r--tests/unit/network_services/traffic_profile/test_ixia_rfc2544.py60
-rw-r--r--tests/unit/network_services/traffic_profile/test_prox_acl.py62
-rw-r--r--tests/unit/network_services/traffic_profile/test_prox_binsearch.py62
-rw-r--r--tests/unit/network_services/traffic_profile/test_prox_profile.py62
-rw-r--r--tests/unit/network_services/traffic_profile/test_prox_ramp.py62
-rw-r--r--tests/unit/network_services/traffic_profile/test_rfc2544.py62
-rw-r--r--tests/unit/network_services/traffic_profile/test_traffic_profile.py63
-rw-r--r--tests/unit/network_services/vnf_generic/vnf/test_acl_vnf.py61
-rw-r--r--tests/unit/network_services/vnf_generic/vnf/test_cgnapt_vnf.py62
-rw-r--r--tests/unit/network_services/vnf_generic/vnf/test_iniparser.py63
-rw-r--r--tests/unit/network_services/vnf_generic/vnf/test_prox_helpers.py61
-rw-r--r--tests/unit/network_services/vnf_generic/vnf/test_prox_vnf.py64
-rw-r--r--tests/unit/network_services/vnf_generic/vnf/test_sample_vnf.py62
-rw-r--r--tests/unit/network_services/vnf_generic/vnf/test_tg_ixload.py62
-rw-r--r--tests/unit/network_services/vnf_generic/vnf/test_tg_ping.py62
-rw-r--r--tests/unit/network_services/vnf_generic/vnf/test_tg_prox.py63
-rw-r--r--tests/unit/network_services/vnf_generic/vnf/test_tg_rfc2544_ixia.py63
-rw-r--r--tests/unit/network_services/vnf_generic/vnf/test_tg_rfc2544_trex.py64
-rw-r--r--tests/unit/network_services/vnf_generic/vnf/test_tg_trex.py62
-rw-r--r--tests/unit/network_services/vnf_generic/vnf/test_udp_replay.py61
-rw-r--r--tests/unit/network_services/vnf_generic/vnf/test_vfw_vnf.py62
-rw-r--r--tests/unit/network_services/vnf_generic/vnf/test_vpe_vnf.py65
-rw-r--r--yardstick/benchmark/scenarios/networking/vnf_generic.py9
-rw-r--r--yardstick/network_services/traffic_profile/fixed.py8
-rw-r--r--yardstick/network_services/traffic_profile/rfc2544.py6
-rw-r--r--yardstick/network_services/traffic_profile/traffic_profile.py61
-rw-r--r--yardstick/network_services/utils.py5
-rw-r--r--yardstick/network_services/vnf_generic/vnf/sample_vnf.py6
35 files changed, 189 insertions, 1546 deletions
diff --git a/docs/testing/user/userguide/14-nsb_installation.rst b/docs/testing/user/userguide/14-nsb_installation.rst
index 3eb17bbca..7c5327964 100644
--- a/docs/testing/user/userguide/14-nsb_installation.rst
+++ b/docs/testing/user/userguide/14-nsb_installation.rst
@@ -103,7 +103,7 @@ Config yardstick conf
cp ./etc/yardstick/yardstick.conf.sample /etc/yardstick/yardstick.conf
vi /etc/yardstick/yardstick.conf
-Add trex_path and bin_path in 'nsb' section.
+Add trex_path, trex_client_lib and bin_path in 'nsb' section.
::
@@ -121,6 +121,7 @@ Add trex_path and bin_path in 'nsb' section.
[nsb]
trex_path=/opt/nsb_bin/trex/scripts
bin_path=/opt/nsb_bin
+ trex_client_lib=/opt/nsb_bin/trex_client/stl
Config pod.yaml describing Topology
diff --git a/etc/yardstick/yardstick.conf.sample b/etc/yardstick/yardstick.conf.sample
index 227aded2d..5675cc3bd 100644
--- a/etc/yardstick/yardstick.conf.sample
+++ b/etc/yardstick/yardstick.conf.sample
@@ -31,3 +31,4 @@ password = root
[nsb]
trex_path=/opt/nsb_bin/trex/scripts
bin_path=/opt/nsb_bin
+trex_client_lib=/opt/nsb_bin/trex_client/stl
diff --git a/nsb_setup.sh b/nsb_setup.sh
index cc2542989..c11dc1038 100755
--- a/nsb_setup.sh
+++ b/nsb_setup.sh
@@ -83,7 +83,7 @@ install_trex()
{
TREX_DIR=$INSTALL_BIN_PATH/trex/scripts
if [ -d "$TREX_DIR" ]; then
- echo "Trex v2.20 already installed. Make sure it contains PYTHONPATH which is required to run TRex"
+ echo "Trex $TREX_VERSION already installed."
else
echo "Build TRex and installing Trex TG in $INSTALL_BIN_PATH/trex"
rm -rf ${TREX_DOWNLOAD##*/}
@@ -99,9 +99,7 @@ install_trex()
cd trex/scripts/ko/src/
make
make install
- # workaround trex module issue
- touch "$REPO_DIR/trex/scripts/automation/trex_control_plane/stl/__init__.py"
- cp "$REPO_DIR/trex/scripts/dpdk_nic_bind.py" "$INSTALL_BIN_PATH"
+ ln -s $TREX_DIR/automation/trex_control_plane $INSTALL_BIN_PATH/trex_client
popd
fi
echo "Done."
diff --git a/tests/unit/__init__.py b/tests/unit/__init__.py
index e69de29bb..a468b272b 100644
--- a/tests/unit/__init__.py
+++ b/tests/unit/__init__.py
@@ -0,0 +1,76 @@
+# Copyright (c) 2017 Intel Corporation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+from __future__ import absolute_import
+import mock
+
+
+STL_MOCKS = {
+ 'trex_stl_lib': mock.MagicMock(),
+ 'trex_stl_lib.base64': mock.MagicMock(),
+ 'trex_stl_lib.binascii': mock.MagicMock(),
+ 'trex_stl_lib.collections': mock.MagicMock(),
+ 'trex_stl_lib.copy': mock.MagicMock(),
+ 'trex_stl_lib.datetime': mock.MagicMock(),
+ 'trex_stl_lib.functools': mock.MagicMock(),
+ 'trex_stl_lib.imp': mock.MagicMock(),
+ 'trex_stl_lib.inspect': mock.MagicMock(),
+ 'trex_stl_lib.json': mock.MagicMock(),
+ 'trex_stl_lib.linecache': mock.MagicMock(),
+ 'trex_stl_lib.math': mock.MagicMock(),
+ 'trex_stl_lib.os': mock.MagicMock(),
+ 'trex_stl_lib.platform': mock.MagicMock(),
+ 'trex_stl_lib.pprint': mock.MagicMock(),
+ 'trex_stl_lib.random': mock.MagicMock(),
+ 'trex_stl_lib.re': mock.MagicMock(),
+ 'trex_stl_lib.scapy': mock.MagicMock(),
+ 'trex_stl_lib.socket': mock.MagicMock(),
+ 'trex_stl_lib.string': mock.MagicMock(),
+ 'trex_stl_lib.struct': mock.MagicMock(),
+ 'trex_stl_lib.sys': mock.MagicMock(),
+ 'trex_stl_lib.threading': mock.MagicMock(),
+ 'trex_stl_lib.time': mock.MagicMock(),
+ 'trex_stl_lib.traceback': mock.MagicMock(),
+ 'trex_stl_lib.trex_stl_async_client': mock.MagicMock(),
+ 'trex_stl_lib.trex_stl_client': mock.MagicMock(),
+ 'trex_stl_lib.trex_stl_exceptions': mock.MagicMock(),
+ 'trex_stl_lib.trex_stl_ext': mock.MagicMock(),
+ 'trex_stl_lib.trex_stl_jsonrpc_client': mock.MagicMock(),
+ 'trex_stl_lib.trex_stl_packet_builder_interface': mock.MagicMock(),
+ 'trex_stl_lib.trex_stl_packet_builder_scapy': mock.MagicMock(),
+ 'trex_stl_lib.trex_stl_port': mock.MagicMock(),
+ 'trex_stl_lib.trex_stl_stats': mock.MagicMock(),
+ 'trex_stl_lib.trex_stl_streams': mock.MagicMock(),
+ 'trex_stl_lib.trex_stl_types': mock.MagicMock(),
+ 'trex_stl_lib.types': mock.MagicMock(),
+ 'trex_stl_lib.utils': mock.MagicMock(),
+ 'trex_stl_lib.utils.argparse': mock.MagicMock(),
+ 'trex_stl_lib.utils.collections': mock.MagicMock(),
+ 'trex_stl_lib.utils.common': mock.MagicMock(),
+ 'trex_stl_lib.utils.json': mock.MagicMock(),
+ 'trex_stl_lib.utils.os': mock.MagicMock(),
+ 'trex_stl_lib.utils.parsing_opts': mock.MagicMock(),
+ 'trex_stl_lib.utils.pwd': mock.MagicMock(),
+ 'trex_stl_lib.utils.random': mock.MagicMock(),
+ 'trex_stl_lib.utils.re': mock.MagicMock(),
+ 'trex_stl_lib.utils.string': mock.MagicMock(),
+ 'trex_stl_lib.utils.sys': mock.MagicMock(),
+ 'trex_stl_lib.utils.text_opts': mock.MagicMock(),
+ 'trex_stl_lib.utils.text_tables': mock.MagicMock(),
+ 'trex_stl_lib.utils.texttable': mock.MagicMock(),
+ 'trex_stl_lib.warnings': mock.MagicMock(),
+ 'trex_stl_lib.yaml': mock.MagicMock(),
+ 'trex_stl_lib.zlib': mock.MagicMock(),
+ 'trex_stl_lib.zmq': mock.MagicMock(),
+}
diff --git a/tests/unit/benchmark/runner/test_search.py b/tests/unit/benchmark/runner/test_search.py
index 9cfe6e154..8fab5a71f 100644
--- a/tests/unit/benchmark/runner/test_search.py
+++ b/tests/unit/benchmark/runner/test_search.py
@@ -14,70 +14,11 @@
#
from __future__ import absolute_import
-import unittest
-from contextlib import contextmanager
+import unittest
import mock
-STL_MOCKS = {
- 'stl': mock.MagicMock(),
- 'stl.trex_stl_lib': mock.MagicMock(),
- 'stl.trex_stl_lib.base64': mock.MagicMock(),
- 'stl.trex_stl_lib.binascii': mock.MagicMock(),
- 'stl.trex_stl_lib.collections': mock.MagicMock(),
- 'stl.trex_stl_lib.copy': mock.MagicMock(),
- 'stl.trex_stl_lib.datetime': mock.MagicMock(),
- 'stl.trex_stl_lib.functools': mock.MagicMock(),
- 'stl.trex_stl_lib.imp': mock.MagicMock(),
- 'stl.trex_stl_lib.inspect': mock.MagicMock(),
- 'stl.trex_stl_lib.json': mock.MagicMock(),
- 'stl.trex_stl_lib.linecache': mock.MagicMock(),
- 'stl.trex_stl_lib.math': mock.MagicMock(),
- 'stl.trex_stl_lib.os': mock.MagicMock(),
- 'stl.trex_stl_lib.platform': mock.MagicMock(),
- 'stl.trex_stl_lib.pprint': mock.MagicMock(),
- 'stl.trex_stl_lib.random': mock.MagicMock(),
- 'stl.trex_stl_lib.re': mock.MagicMock(),
- 'stl.trex_stl_lib.scapy': mock.MagicMock(),
- 'stl.trex_stl_lib.socket': mock.MagicMock(),
- 'stl.trex_stl_lib.string': mock.MagicMock(),
- 'stl.trex_stl_lib.struct': mock.MagicMock(),
- 'stl.trex_stl_lib.sys': mock.MagicMock(),
- 'stl.trex_stl_lib.threading': mock.MagicMock(),
- 'stl.trex_stl_lib.time': mock.MagicMock(),
- 'stl.trex_stl_lib.traceback': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_async_client': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_client': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_exceptions': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_ext': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_jsonrpc_client': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_packet_builder_interface': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_packet_builder_scapy': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_port': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_stats': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_streams': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_types': mock.MagicMock(),
- 'stl.trex_stl_lib.types': mock.MagicMock(),
- 'stl.trex_stl_lib.utils': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.argparse': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.collections': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.common': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.json': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.os': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.parsing_opts': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.pwd': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.random': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.re': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.string': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.sys': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.text_opts': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.text_tables': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.texttable': mock.MagicMock(),
- 'stl.trex_stl_lib.warnings': mock.MagicMock(),
- 'stl.trex_stl_lib.yaml': mock.MagicMock(),
- 'stl.trex_stl_lib.zlib': mock.MagicMock(),
- 'stl.trex_stl_lib.zmq': mock.MagicMock(),
-}
+from tests.unit import STL_MOCKS
STLClient = mock.MagicMock()
stl_patch = mock.patch.dict("sys.modules", STL_MOCKS)
diff --git a/tests/unit/benchmark/scenarios/networking/test_vnf_generic.py b/tests/unit/benchmark/scenarios/networking/test_vnf_generic.py
index 8ce33625b..df5047a0d 100644
--- a/tests/unit/benchmark/scenarios/networking/test_vnf_generic.py
+++ b/tests/unit/benchmark/scenarios/networking/test_vnf_generic.py
@@ -24,6 +24,7 @@ import errno
import unittest
import mock
+from tests.unit import STL_MOCKS
from yardstick.benchmark.scenarios.networking.vnf_generic import \
SshManager, NetworkServiceTestCase, IncorrectConfig, \
open_relative_file
@@ -31,65 +32,6 @@ from yardstick.network_services.collector.subscriber import Collector
from yardstick.network_services.vnf_generic.vnf.base import \
GenericTrafficGen, GenericVNF
-STL_MOCKS = {
- 'stl': mock.MagicMock(),
- 'stl.trex_stl_lib': mock.MagicMock(),
- 'stl.trex_stl_lib.base64': mock.MagicMock(),
- 'stl.trex_stl_lib.binascii': mock.MagicMock(),
- 'stl.trex_stl_lib.collections': mock.MagicMock(),
- 'stl.trex_stl_lib.copy': mock.MagicMock(),
- 'stl.trex_stl_lib.datetime': mock.MagicMock(),
- 'stl.trex_stl_lib.functools': mock.MagicMock(),
- 'stl.trex_stl_lib.imp': mock.MagicMock(),
- 'stl.trex_stl_lib.inspect': mock.MagicMock(),
- 'stl.trex_stl_lib.json': mock.MagicMock(),
- 'stl.trex_stl_lib.linecache': mock.MagicMock(),
- 'stl.trex_stl_lib.math': mock.MagicMock(),
- 'stl.trex_stl_lib.os': mock.MagicMock(),
- 'stl.trex_stl_lib.platform': mock.MagicMock(),
- 'stl.trex_stl_lib.pprint': mock.MagicMock(),
- 'stl.trex_stl_lib.random': mock.MagicMock(),
- 'stl.trex_stl_lib.re': mock.MagicMock(),
- 'stl.trex_stl_lib.scapy': mock.MagicMock(),
- 'stl.trex_stl_lib.socket': mock.MagicMock(),
- 'stl.trex_stl_lib.string': mock.MagicMock(),
- 'stl.trex_stl_lib.struct': mock.MagicMock(),
- 'stl.trex_stl_lib.sys': mock.MagicMock(),
- 'stl.trex_stl_lib.threading': mock.MagicMock(),
- 'stl.trex_stl_lib.time': mock.MagicMock(),
- 'stl.trex_stl_lib.traceback': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_async_client': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_client': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_exceptions': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_ext': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_jsonrpc_client': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_packet_builder_interface': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_packet_builder_scapy': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_port': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_stats': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_streams': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_types': mock.MagicMock(),
- 'stl.trex_stl_lib.types': mock.MagicMock(),
- 'stl.trex_stl_lib.utils': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.argparse': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.collections': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.common': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.json': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.os': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.parsing_opts': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.pwd': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.random': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.re': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.string': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.sys': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.text_opts': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.text_tables': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.texttable': mock.MagicMock(),
- 'stl.trex_stl_lib.warnings': mock.MagicMock(),
- 'stl.trex_stl_lib.yaml': mock.MagicMock(),
- 'stl.trex_stl_lib.zlib': mock.MagicMock(),
- 'stl.trex_stl_lib.zmq': mock.MagicMock(),
-}
COMPLETE_TREX_VNFD = {
'vnfd:vnfd-catalog': {
diff --git a/tests/unit/network_services/traffic_profile/test_fixed.py b/tests/unit/network_services/traffic_profile/test_fixed.py
index 8b44719a1..84843178e 100644
--- a/tests/unit/network_services/traffic_profile/test_fixed.py
+++ b/tests/unit/network_services/traffic_profile/test_fixed.py
@@ -16,68 +16,11 @@
#
from __future__ import absolute_import
+
import unittest
import mock
-STL_MOCKS = {
- 'stl': mock.MagicMock(),
- 'stl.trex_stl_lib': mock.MagicMock(),
- 'stl.trex_stl_lib.base64': mock.MagicMock(),
- 'stl.trex_stl_lib.binascii': mock.MagicMock(),
- 'stl.trex_stl_lib.collections': mock.MagicMock(),
- 'stl.trex_stl_lib.copy': mock.MagicMock(),
- 'stl.trex_stl_lib.datetime': mock.MagicMock(),
- 'stl.trex_stl_lib.functools': mock.MagicMock(),
- 'stl.trex_stl_lib.imp': mock.MagicMock(),
- 'stl.trex_stl_lib.inspect': mock.MagicMock(),
- 'stl.trex_stl_lib.json': mock.MagicMock(),
- 'stl.trex_stl_lib.linecache': mock.MagicMock(),
- 'stl.trex_stl_lib.math': mock.MagicMock(),
- 'stl.trex_stl_lib.os': mock.MagicMock(),
- 'stl.trex_stl_lib.platform': mock.MagicMock(),
- 'stl.trex_stl_lib.pprint': mock.MagicMock(),
- 'stl.trex_stl_lib.random': mock.MagicMock(),
- 'stl.trex_stl_lib.re': mock.MagicMock(),
- 'stl.trex_stl_lib.scapy': mock.MagicMock(),
- 'stl.trex_stl_lib.socket': mock.MagicMock(),
- 'stl.trex_stl_lib.string': mock.MagicMock(),
- 'stl.trex_stl_lib.struct': mock.MagicMock(),
- 'stl.trex_stl_lib.sys': mock.MagicMock(),
- 'stl.trex_stl_lib.threading': mock.MagicMock(),
- 'stl.trex_stl_lib.time': mock.MagicMock(),
- 'stl.trex_stl_lib.traceback': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_async_client': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_client': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_exceptions': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_ext': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_jsonrpc_client': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_packet_builder_interface': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_packet_builder_scapy': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_port': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_stats': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_streams': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_types': mock.MagicMock(),
- 'stl.trex_stl_lib.types': mock.MagicMock(),
- 'stl.trex_stl_lib.utils': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.argparse': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.collections': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.common': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.json': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.os': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.parsing_opts': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.pwd': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.random': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.re': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.string': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.sys': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.text_opts': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.text_tables': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.texttable': mock.MagicMock(),
- 'stl.trex_stl_lib.warnings': mock.MagicMock(),
- 'stl.trex_stl_lib.yaml': mock.MagicMock(),
- 'stl.trex_stl_lib.zlib': mock.MagicMock(),
- 'stl.trex_stl_lib.zmq': mock.MagicMock(),
-}
+from tests.unit import STL_MOCKS
STLClient = mock.MagicMock()
stl_patch = mock.patch.dict("sys.modules", STL_MOCKS)
diff --git a/tests/unit/network_services/traffic_profile/test_ixia_rfc2544.py b/tests/unit/network_services/traffic_profile/test_ixia_rfc2544.py
index 6dba64af9..b2cb9dfea 100644
--- a/tests/unit/network_services/traffic_profile/test_ixia_rfc2544.py
+++ b/tests/unit/network_services/traffic_profile/test_ixia_rfc2544.py
@@ -20,65 +20,7 @@ from __future__ import division
import unittest
import mock
-STL_MOCKS = {
- 'stl': mock.MagicMock(),
- 'stl.trex_stl_lib': mock.MagicMock(),
- 'stl.trex_stl_lib.base64': mock.MagicMock(),
- 'stl.trex_stl_lib.binascii': mock.MagicMock(),
- 'stl.trex_stl_lib.collections': mock.MagicMock(),
- 'stl.trex_stl_lib.copy': mock.MagicMock(),
- 'stl.trex_stl_lib.datetime': mock.MagicMock(),
- 'stl.trex_stl_lib.functools': mock.MagicMock(),
- 'stl.trex_stl_lib.imp': mock.MagicMock(),
- 'stl.trex_stl_lib.inspect': mock.MagicMock(),
- 'stl.trex_stl_lib.json': mock.MagicMock(),
- 'stl.trex_stl_lib.linecache': mock.MagicMock(),
- 'stl.trex_stl_lib.math': mock.MagicMock(),
- 'stl.trex_stl_lib.os': mock.MagicMock(),
- 'stl.trex_stl_lib.platform': mock.MagicMock(),
- 'stl.trex_stl_lib.pprint': mock.MagicMock(),
- 'stl.trex_stl_lib.random': mock.MagicMock(),
- 'stl.trex_stl_lib.re': mock.MagicMock(),
- 'stl.trex_stl_lib.scapy': mock.MagicMock(),
- 'stl.trex_stl_lib.socket': mock.MagicMock(),
- 'stl.trex_stl_lib.string': mock.MagicMock(),
- 'stl.trex_stl_lib.struct': mock.MagicMock(),
- 'stl.trex_stl_lib.sys': mock.MagicMock(),
- 'stl.trex_stl_lib.threading': mock.MagicMock(),
- 'stl.trex_stl_lib.time': mock.MagicMock(),
- 'stl.trex_stl_lib.traceback': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_async_client': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_client': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_exceptions': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_ext': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_jsonrpc_client': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_packet_builder_interface': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_packet_builder_scapy': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_port': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_stats': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_streams': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_types': mock.MagicMock(),
- 'stl.trex_stl_lib.types': mock.MagicMock(),
- 'stl.trex_stl_lib.utils': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.argparse': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.collections': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.common': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.json': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.os': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.parsing_opts': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.pwd': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.random': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.re': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.string': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.sys': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.text_opts': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.text_tables': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.texttable': mock.MagicMock(),
- 'stl.trex_stl_lib.warnings': mock.MagicMock(),
- 'stl.trex_stl_lib.yaml': mock.MagicMock(),
- 'stl.trex_stl_lib.zlib': mock.MagicMock(),
- 'stl.trex_stl_lib.zmq': mock.MagicMock(),
-}
+from tests.unit import STL_MOCKS
STLClient = mock.MagicMock()
stl_patch = mock.patch.dict("sys.modules", STL_MOCKS)
diff --git a/tests/unit/network_services/traffic_profile/test_prox_acl.py b/tests/unit/network_services/traffic_profile/test_prox_acl.py
index 252c655da..be172f26b 100644
--- a/tests/unit/network_services/traffic_profile/test_prox_acl.py
+++ b/tests/unit/network_services/traffic_profile/test_prox_acl.py
@@ -14,69 +14,11 @@
#
from __future__ import absolute_import
-import unittest
+import unittest
import mock
-STL_MOCKS = {
- 'stl': mock.MagicMock(),
- 'stl.trex_stl_lib': mock.MagicMock(),
- 'stl.trex_stl_lib.base64': mock.MagicMock(),
- 'stl.trex_stl_lib.binascii': mock.MagicMock(),
- 'stl.trex_stl_lib.collections': mock.MagicMock(),
- 'stl.trex_stl_lib.copy': mock.MagicMock(),
- 'stl.trex_stl_lib.datetime': mock.MagicMock(),
- 'stl.trex_stl_lib.functools': mock.MagicMock(),
- 'stl.trex_stl_lib.imp': mock.MagicMock(),
- 'stl.trex_stl_lib.inspect': mock.MagicMock(),
- 'stl.trex_stl_lib.json': mock.MagicMock(),
- 'stl.trex_stl_lib.linecache': mock.MagicMock(),
- 'stl.trex_stl_lib.math': mock.MagicMock(),
- 'stl.trex_stl_lib.os': mock.MagicMock(),
- 'stl.trex_stl_lib.platform': mock.MagicMock(),
- 'stl.trex_stl_lib.pprint': mock.MagicMock(),
- 'stl.trex_stl_lib.random': mock.MagicMock(),
- 'stl.trex_stl_lib.re': mock.MagicMock(),
- 'stl.trex_stl_lib.scapy': mock.MagicMock(),
- 'stl.trex_stl_lib.socket': mock.MagicMock(),
- 'stl.trex_stl_lib.string': mock.MagicMock(),
- 'stl.trex_stl_lib.struct': mock.MagicMock(),
- 'stl.trex_stl_lib.sys': mock.MagicMock(),
- 'stl.trex_stl_lib.threading': mock.MagicMock(),
- 'stl.trex_stl_lib.time': mock.MagicMock(),
- 'stl.trex_stl_lib.traceback': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_async_client': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_client': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_exceptions': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_ext': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_jsonrpc_client': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_packet_builder_interface': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_packet_builder_scapy': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_port': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_stats': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_streams': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_types': mock.MagicMock(),
- 'stl.trex_stl_lib.types': mock.MagicMock(),
- 'stl.trex_stl_lib.utils': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.argparse': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.collections': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.common': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.json': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.os': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.parsing_opts': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.pwd': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.random': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.re': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.string': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.sys': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.text_opts': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.text_tables': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.texttable': mock.MagicMock(),
- 'stl.trex_stl_lib.warnings': mock.MagicMock(),
- 'stl.trex_stl_lib.yaml': mock.MagicMock(),
- 'stl.trex_stl_lib.zlib': mock.MagicMock(),
- 'stl.trex_stl_lib.zmq': mock.MagicMock(),
-}
+from tests.unit import STL_MOCKS
STLClient = mock.MagicMock()
stl_patch = mock.patch.dict("sys.modules", STL_MOCKS)
diff --git a/tests/unit/network_services/traffic_profile/test_prox_binsearch.py b/tests/unit/network_services/traffic_profile/test_prox_binsearch.py
index 74e6121a7..72b86709c 100644
--- a/tests/unit/network_services/traffic_profile/test_prox_binsearch.py
+++ b/tests/unit/network_services/traffic_profile/test_prox_binsearch.py
@@ -14,69 +14,11 @@
#
from __future__ import absolute_import
-import unittest
+import unittest
import mock
-STL_MOCKS = {
- 'stl': mock.MagicMock(),
- 'stl.trex_stl_lib': mock.MagicMock(),
- 'stl.trex_stl_lib.base64': mock.MagicMock(),
- 'stl.trex_stl_lib.binascii': mock.MagicMock(),
- 'stl.trex_stl_lib.collections': mock.MagicMock(),
- 'stl.trex_stl_lib.copy': mock.MagicMock(),
- 'stl.trex_stl_lib.datetime': mock.MagicMock(),
- 'stl.trex_stl_lib.functools': mock.MagicMock(),
- 'stl.trex_stl_lib.imp': mock.MagicMock(),
- 'stl.trex_stl_lib.inspect': mock.MagicMock(),
- 'stl.trex_stl_lib.json': mock.MagicMock(),
- 'stl.trex_stl_lib.linecache': mock.MagicMock(),
- 'stl.trex_stl_lib.math': mock.MagicMock(),
- 'stl.trex_stl_lib.os': mock.MagicMock(),
- 'stl.trex_stl_lib.platform': mock.MagicMock(),
- 'stl.trex_stl_lib.pprint': mock.MagicMock(),
- 'stl.trex_stl_lib.random': mock.MagicMock(),
- 'stl.trex_stl_lib.re': mock.MagicMock(),
- 'stl.trex_stl_lib.scapy': mock.MagicMock(),
- 'stl.trex_stl_lib.socket': mock.MagicMock(),
- 'stl.trex_stl_lib.string': mock.MagicMock(),
- 'stl.trex_stl_lib.struct': mock.MagicMock(),
- 'stl.trex_stl_lib.sys': mock.MagicMock(),
- 'stl.trex_stl_lib.threading': mock.MagicMock(),
- 'stl.trex_stl_lib.time': mock.MagicMock(),
- 'stl.trex_stl_lib.traceback': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_async_client': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_client': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_exceptions': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_ext': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_jsonrpc_client': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_packet_builder_interface': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_packet_builder_scapy': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_port': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_stats': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_streams': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_types': mock.MagicMock(),
- 'stl.trex_stl_lib.types': mock.MagicMock(),
- 'stl.trex_stl_lib.utils': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.argparse': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.collections': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.common': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.json': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.os': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.parsing_opts': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.pwd': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.random': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.re': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.string': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.sys': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.text_opts': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.text_tables': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.texttable': mock.MagicMock(),
- 'stl.trex_stl_lib.warnings': mock.MagicMock(),
- 'stl.trex_stl_lib.yaml': mock.MagicMock(),
- 'stl.trex_stl_lib.zlib': mock.MagicMock(),
- 'stl.trex_stl_lib.zmq': mock.MagicMock(),
-}
+from tests.unit import STL_MOCKS
STLClient = mock.MagicMock()
stl_patch = mock.patch.dict("sys.modules", STL_MOCKS)
diff --git a/tests/unit/network_services/traffic_profile/test_prox_profile.py b/tests/unit/network_services/traffic_profile/test_prox_profile.py
index a2ad0333f..14223da0f 100644
--- a/tests/unit/network_services/traffic_profile/test_prox_profile.py
+++ b/tests/unit/network_services/traffic_profile/test_prox_profile.py
@@ -14,69 +14,11 @@
#
from __future__ import absolute_import
-import unittest
+import unittest
import mock
-STL_MOCKS = {
- 'stl': mock.MagicMock(),
- 'stl.trex_stl_lib': mock.MagicMock(),
- 'stl.trex_stl_lib.base64': mock.MagicMock(),
- 'stl.trex_stl_lib.binascii': mock.MagicMock(),
- 'stl.trex_stl_lib.collections': mock.MagicMock(),
- 'stl.trex_stl_lib.copy': mock.MagicMock(),
- 'stl.trex_stl_lib.datetime': mock.MagicMock(),
- 'stl.trex_stl_lib.functools': mock.MagicMock(),
- 'stl.trex_stl_lib.imp': mock.MagicMock(),
- 'stl.trex_stl_lib.inspect': mock.MagicMock(),
- 'stl.trex_stl_lib.json': mock.MagicMock(),
- 'stl.trex_stl_lib.linecache': mock.MagicMock(),
- 'stl.trex_stl_lib.math': mock.MagicMock(),
- 'stl.trex_stl_lib.os': mock.MagicMock(),
- 'stl.trex_stl_lib.platform': mock.MagicMock(),
- 'stl.trex_stl_lib.pprint': mock.MagicMock(),
- 'stl.trex_stl_lib.random': mock.MagicMock(),
- 'stl.trex_stl_lib.re': mock.MagicMock(),
- 'stl.trex_stl_lib.scapy': mock.MagicMock(),
- 'stl.trex_stl_lib.socket': mock.MagicMock(),
- 'stl.trex_stl_lib.string': mock.MagicMock(),
- 'stl.trex_stl_lib.struct': mock.MagicMock(),
- 'stl.trex_stl_lib.sys': mock.MagicMock(),
- 'stl.trex_stl_lib.threading': mock.MagicMock(),
- 'stl.trex_stl_lib.time': mock.MagicMock(),
- 'stl.trex_stl_lib.traceback': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_async_client': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_client': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_exceptions': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_ext': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_jsonrpc_client': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_packet_builder_interface': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_packet_builder_scapy': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_port': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_stats': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_streams': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_types': mock.MagicMock(),
- 'stl.trex_stl_lib.types': mock.MagicMock(),
- 'stl.trex_stl_lib.utils': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.argparse': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.collections': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.common': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.json': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.os': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.parsing_opts': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.pwd': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.random': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.re': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.string': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.sys': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.text_opts': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.text_tables': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.texttable': mock.MagicMock(),
- 'stl.trex_stl_lib.warnings': mock.MagicMock(),
- 'stl.trex_stl_lib.yaml': mock.MagicMock(),
- 'stl.trex_stl_lib.zlib': mock.MagicMock(),
- 'stl.trex_stl_lib.zmq': mock.MagicMock(),
-}
+from tests.unit import STL_MOCKS
STLClient = mock.MagicMock()
stl_patch = mock.patch.dict("sys.modules", STL_MOCKS)
diff --git a/tests/unit/network_services/traffic_profile/test_prox_ramp.py b/tests/unit/network_services/traffic_profile/test_prox_ramp.py
index 19e6ff8cb..357298759 100644
--- a/tests/unit/network_services/traffic_profile/test_prox_ramp.py
+++ b/tests/unit/network_services/traffic_profile/test_prox_ramp.py
@@ -14,69 +14,11 @@
#
from __future__ import absolute_import
-import unittest
+import unittest
import mock
-STL_MOCKS = {
- 'stl': mock.MagicMock(),
- 'stl.trex_stl_lib': mock.MagicMock(),
- 'stl.trex_stl_lib.base64': mock.MagicMock(),
- 'stl.trex_stl_lib.binascii': mock.MagicMock(),
- 'stl.trex_stl_lib.collections': mock.MagicMock(),
- 'stl.trex_stl_lib.copy': mock.MagicMock(),
- 'stl.trex_stl_lib.datetime': mock.MagicMock(),
- 'stl.trex_stl_lib.functools': mock.MagicMock(),
- 'stl.trex_stl_lib.imp': mock.MagicMock(),
- 'stl.trex_stl_lib.inspect': mock.MagicMock(),
- 'stl.trex_stl_lib.json': mock.MagicMock(),
- 'stl.trex_stl_lib.linecache': mock.MagicMock(),
- 'stl.trex_stl_lib.math': mock.MagicMock(),
- 'stl.trex_stl_lib.os': mock.MagicMock(),
- 'stl.trex_stl_lib.platform': mock.MagicMock(),
- 'stl.trex_stl_lib.pprint': mock.MagicMock(),
- 'stl.trex_stl_lib.random': mock.MagicMock(),
- 'stl.trex_stl_lib.re': mock.MagicMock(),
- 'stl.trex_stl_lib.scapy': mock.MagicMock(),
- 'stl.trex_stl_lib.socket': mock.MagicMock(),
- 'stl.trex_stl_lib.string': mock.MagicMock(),
- 'stl.trex_stl_lib.struct': mock.MagicMock(),
- 'stl.trex_stl_lib.sys': mock.MagicMock(),
- 'stl.trex_stl_lib.threading': mock.MagicMock(),
- 'stl.trex_stl_lib.time': mock.MagicMock(),
- 'stl.trex_stl_lib.traceback': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_async_client': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_client': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_exceptions': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_ext': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_jsonrpc_client': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_packet_builder_interface': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_packet_builder_scapy': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_port': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_stats': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_streams': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_types': mock.MagicMock(),
- 'stl.trex_stl_lib.types': mock.MagicMock(),
- 'stl.trex_stl_lib.utils': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.argparse': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.collections': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.common': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.json': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.os': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.parsing_opts': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.pwd': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.random': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.re': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.string': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.sys': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.text_opts': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.text_tables': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.texttable': mock.MagicMock(),
- 'stl.trex_stl_lib.warnings': mock.MagicMock(),
- 'stl.trex_stl_lib.yaml': mock.MagicMock(),
- 'stl.trex_stl_lib.zlib': mock.MagicMock(),
- 'stl.trex_stl_lib.zmq': mock.MagicMock(),
-}
+from tests.unit import STL_MOCKS
STLClient = mock.MagicMock()
stl_patch = mock.patch.dict("sys.modules", STL_MOCKS)
diff --git a/tests/unit/network_services/traffic_profile/test_rfc2544.py b/tests/unit/network_services/traffic_profile/test_rfc2544.py
index 04b7efc48..aef0b93de 100644
--- a/tests/unit/network_services/traffic_profile/test_rfc2544.py
+++ b/tests/unit/network_services/traffic_profile/test_rfc2544.py
@@ -17,68 +17,12 @@
from __future__ import absolute_import
from __future__ import division
+
import unittest
import mock
-STL_MOCKS = {
- 'stl': mock.MagicMock(),
- 'stl.trex_stl_lib': mock.MagicMock(),
- 'stl.trex_stl_lib.base64': mock.MagicMock(),
- 'stl.trex_stl_lib.binascii': mock.MagicMock(),
- 'stl.trex_stl_lib.collections': mock.MagicMock(),
- 'stl.trex_stl_lib.copy': mock.MagicMock(),
- 'stl.trex_stl_lib.datetime': mock.MagicMock(),
- 'stl.trex_stl_lib.functools': mock.MagicMock(),
- 'stl.trex_stl_lib.imp': mock.MagicMock(),
- 'stl.trex_stl_lib.inspect': mock.MagicMock(),
- 'stl.trex_stl_lib.json': mock.MagicMock(),
- 'stl.trex_stl_lib.linecache': mock.MagicMock(),
- 'stl.trex_stl_lib.math': mock.MagicMock(),
- 'stl.trex_stl_lib.os': mock.MagicMock(),
- 'stl.trex_stl_lib.platform': mock.MagicMock(),
- 'stl.trex_stl_lib.pprint': mock.MagicMock(),
- 'stl.trex_stl_lib.random': mock.MagicMock(),
- 'stl.trex_stl_lib.re': mock.MagicMock(),
- 'stl.trex_stl_lib.scapy': mock.MagicMock(),
- 'stl.trex_stl_lib.socket': mock.MagicMock(),
- 'stl.trex_stl_lib.string': mock.MagicMock(),
- 'stl.trex_stl_lib.struct': mock.MagicMock(),
- 'stl.trex_stl_lib.sys': mock.MagicMock(),
- 'stl.trex_stl_lib.threading': mock.MagicMock(),
- 'stl.trex_stl_lib.time': mock.MagicMock(),
- 'stl.trex_stl_lib.traceback': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_async_client': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_client': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_exceptions': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_ext': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_jsonrpc_client': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_packet_builder_interface': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_packet_builder_scapy': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_port': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_stats': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_streams': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_types': mock.MagicMock(),
- 'stl.trex_stl_lib.types': mock.MagicMock(),
- 'stl.trex_stl_lib.utils': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.argparse': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.collections': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.common': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.json': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.os': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.parsing_opts': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.pwd': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.random': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.re': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.string': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.sys': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.text_opts': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.text_tables': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.texttable': mock.MagicMock(),
- 'stl.trex_stl_lib.warnings': mock.MagicMock(),
- 'stl.trex_stl_lib.yaml': mock.MagicMock(),
- 'stl.trex_stl_lib.zlib': mock.MagicMock(),
- 'stl.trex_stl_lib.zmq': mock.MagicMock(),
-}
+from tests.unit import STL_MOCKS
+
STLClient = mock.MagicMock()
stl_patch = mock.patch.dict("sys.modules", STL_MOCKS)
diff --git a/tests/unit/network_services/traffic_profile/test_traffic_profile.py b/tests/unit/network_services/traffic_profile/test_traffic_profile.py
index 37193f862..9a78c36a3 100644
--- a/tests/unit/network_services/traffic_profile/test_traffic_profile.py
+++ b/tests/unit/network_services/traffic_profile/test_traffic_profile.py
@@ -16,69 +16,12 @@
#
from __future__ import absolute_import
-import unittest
+import unittest
import mock
-STL_MOCKS = {
- 'stl': mock.MagicMock(),
- 'stl.trex_stl_lib': mock.MagicMock(),
- 'stl.trex_stl_lib.base64': mock.MagicMock(),
- 'stl.trex_stl_lib.binascii': mock.MagicMock(),
- 'stl.trex_stl_lib.collections': mock.MagicMock(),
- 'stl.trex_stl_lib.copy': mock.MagicMock(),
- 'stl.trex_stl_lib.datetime': mock.MagicMock(),
- 'stl.trex_stl_lib.functools': mock.MagicMock(),
- 'stl.trex_stl_lib.imp': mock.MagicMock(),
- 'stl.trex_stl_lib.inspect': mock.MagicMock(),
- 'stl.trex_stl_lib.json': mock.MagicMock(),
- 'stl.trex_stl_lib.linecache': mock.MagicMock(),
- 'stl.trex_stl_lib.math': mock.MagicMock(),
- 'stl.trex_stl_lib.os': mock.MagicMock(),
- 'stl.trex_stl_lib.platform': mock.MagicMock(),
- 'stl.trex_stl_lib.pprint': mock.MagicMock(),
- 'stl.trex_stl_lib.random': mock.MagicMock(),
- 'stl.trex_stl_lib.re': mock.MagicMock(),
- 'stl.trex_stl_lib.scapy': mock.MagicMock(),
- 'stl.trex_stl_lib.socket': mock.MagicMock(),
- 'stl.trex_stl_lib.string': mock.MagicMock(),
- 'stl.trex_stl_lib.struct': mock.MagicMock(),
- 'stl.trex_stl_lib.sys': mock.MagicMock(),
- 'stl.trex_stl_lib.threading': mock.MagicMock(),
- 'stl.trex_stl_lib.time': mock.MagicMock(),
- 'stl.trex_stl_lib.traceback': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_async_client': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_client': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_exceptions': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_ext': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_jsonrpc_client': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_packet_builder_interface': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_packet_builder_scapy': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_port': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_stats': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_streams': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_types': mock.MagicMock(),
- 'stl.trex_stl_lib.types': mock.MagicMock(),
- 'stl.trex_stl_lib.utils': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.argparse': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.collections': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.common': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.json': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.os': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.parsing_opts': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.pwd': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.random': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.re': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.string': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.sys': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.text_opts': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.text_tables': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.texttable': mock.MagicMock(),
- 'stl.trex_stl_lib.warnings': mock.MagicMock(),
- 'stl.trex_stl_lib.yaml': mock.MagicMock(),
- 'stl.trex_stl_lib.zlib': mock.MagicMock(),
- 'stl.trex_stl_lib.zmq': mock.MagicMock(),
-}
+from tests.unit import STL_MOCKS
+
STLClient = mock.MagicMock()
stl_patch = mock.patch.dict("sys.modules", STL_MOCKS)
diff --git a/tests/unit/network_services/vnf_generic/vnf/test_acl_vnf.py b/tests/unit/network_services/vnf_generic/vnf/test_acl_vnf.py
index a63a59d48..7570067b9 100644
--- a/tests/unit/network_services/vnf_generic/vnf/test_acl_vnf.py
+++ b/tests/unit/network_services/vnf_generic/vnf/test_acl_vnf.py
@@ -16,70 +16,13 @@
#
from __future__ import absolute_import
+
import unittest
import mock
import os
+from tests.unit import STL_MOCKS
-STL_MOCKS = {
- 'stl': mock.MagicMock(),
- 'stl.trex_stl_lib': mock.MagicMock(),
- 'stl.trex_stl_lib.base64': mock.MagicMock(),
- 'stl.trex_stl_lib.binascii': mock.MagicMock(),
- 'stl.trex_stl_lib.collections': mock.MagicMock(),
- 'stl.trex_stl_lib.copy': mock.MagicMock(),
- 'stl.trex_stl_lib.datetime': mock.MagicMock(),
- 'stl.trex_stl_lib.functools': mock.MagicMock(),
- 'stl.trex_stl_lib.imp': mock.MagicMock(),
- 'stl.trex_stl_lib.inspect': mock.MagicMock(),
- 'stl.trex_stl_lib.json': mock.MagicMock(),
- 'stl.trex_stl_lib.linecache': mock.MagicMock(),
- 'stl.trex_stl_lib.math': mock.MagicMock(),
- 'stl.trex_stl_lib.os': mock.MagicMock(),
- 'stl.trex_stl_lib.platform': mock.MagicMock(),
- 'stl.trex_stl_lib.pprint': mock.MagicMock(),
- 'stl.trex_stl_lib.random': mock.MagicMock(),
- 'stl.trex_stl_lib.re': mock.MagicMock(),
- 'stl.trex_stl_lib.scapy': mock.MagicMock(),
- 'stl.trex_stl_lib.socket': mock.MagicMock(),
- 'stl.trex_stl_lib.string': mock.MagicMock(),
- 'stl.trex_stl_lib.struct': mock.MagicMock(),
- 'stl.trex_stl_lib.sys': mock.MagicMock(),
- 'stl.trex_stl_lib.threading': mock.MagicMock(),
- 'stl.trex_stl_lib.time': mock.MagicMock(),
- 'stl.trex_stl_lib.traceback': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_async_client': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_client': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_exceptions': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_ext': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_jsonrpc_client': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_packet_builder_interface': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_packet_builder_scapy': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_port': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_stats': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_streams': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_types': mock.MagicMock(),
- 'stl.trex_stl_lib.types': mock.MagicMock(),
- 'stl.trex_stl_lib.utils': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.argparse': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.collections': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.common': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.json': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.os': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.parsing_opts': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.pwd': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.random': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.re': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.string': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.sys': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.text_opts': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.text_tables': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.texttable': mock.MagicMock(),
- 'stl.trex_stl_lib.warnings': mock.MagicMock(),
- 'stl.trex_stl_lib.yaml': mock.MagicMock(),
- 'stl.trex_stl_lib.zlib': mock.MagicMock(),
- 'stl.trex_stl_lib.zmq': mock.MagicMock(),
-}
STLClient = mock.MagicMock()
stl_patch = mock.patch.dict("sys.modules", STL_MOCKS)
diff --git a/tests/unit/network_services/vnf_generic/vnf/test_cgnapt_vnf.py b/tests/unit/network_services/vnf_generic/vnf/test_cgnapt_vnf.py
index bf226d2c8..f214d66f6 100644
--- a/tests/unit/network_services/vnf_generic/vnf/test_cgnapt_vnf.py
+++ b/tests/unit/network_services/vnf_generic/vnf/test_cgnapt_vnf.py
@@ -19,68 +19,10 @@ from __future__ import absolute_import
import os
import unittest
-
import mock
-STL_MOCKS = {
- 'stl': mock.MagicMock(),
- 'stl.trex_stl_lib': mock.MagicMock(),
- 'stl.trex_stl_lib.base64': mock.MagicMock(),
- 'stl.trex_stl_lib.binascii': mock.MagicMock(),
- 'stl.trex_stl_lib.collections': mock.MagicMock(),
- 'stl.trex_stl_lib.copy': mock.MagicMock(),
- 'stl.trex_stl_lib.datetime': mock.MagicMock(),
- 'stl.trex_stl_lib.functools': mock.MagicMock(),
- 'stl.trex_stl_lib.imp': mock.MagicMock(),
- 'stl.trex_stl_lib.inspect': mock.MagicMock(),
- 'stl.trex_stl_lib.json': mock.MagicMock(),
- 'stl.trex_stl_lib.linecache': mock.MagicMock(),
- 'stl.trex_stl_lib.math': mock.MagicMock(),
- 'stl.trex_stl_lib.os': mock.MagicMock(),
- 'stl.trex_stl_lib.platform': mock.MagicMock(),
- 'stl.trex_stl_lib.pprint': mock.MagicMock(),
- 'stl.trex_stl_lib.random': mock.MagicMock(),
- 'stl.trex_stl_lib.re': mock.MagicMock(),
- 'stl.trex_stl_lib.scapy': mock.MagicMock(),
- 'stl.trex_stl_lib.socket': mock.MagicMock(),
- 'stl.trex_stl_lib.string': mock.MagicMock(),
- 'stl.trex_stl_lib.struct': mock.MagicMock(),
- 'stl.trex_stl_lib.sys': mock.MagicMock(),
- 'stl.trex_stl_lib.threading': mock.MagicMock(),
- 'stl.trex_stl_lib.time': mock.MagicMock(),
- 'stl.trex_stl_lib.traceback': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_async_client': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_client': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_exceptions': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_ext': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_jsonrpc_client': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_packet_builder_interface': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_packet_builder_scapy': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_port': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_stats': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_streams': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_types': mock.MagicMock(),
- 'stl.trex_stl_lib.types': mock.MagicMock(),
- 'stl.trex_stl_lib.utils': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.argparse': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.collections': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.common': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.json': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.os': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.parsing_opts': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.pwd': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.random': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.re': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.string': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.sys': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.text_opts': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.text_tables': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.texttable': mock.MagicMock(),
- 'stl.trex_stl_lib.warnings': mock.MagicMock(),
- 'stl.trex_stl_lib.yaml': mock.MagicMock(),
- 'stl.trex_stl_lib.zlib': mock.MagicMock(),
- 'stl.trex_stl_lib.zmq': mock.MagicMock(),
-}
+from tests.unit import STL_MOCKS
+
STLClient = mock.MagicMock()
stl_patch = mock.patch.dict("sys.modules", STL_MOCKS)
diff --git a/tests/unit/network_services/vnf_generic/vnf/test_iniparser.py b/tests/unit/network_services/vnf_generic/vnf/test_iniparser.py
index 53481ddd0..b74e5d9fd 100644
--- a/tests/unit/network_services/vnf_generic/vnf/test_iniparser.py
+++ b/tests/unit/network_services/vnf_generic/vnf/test_iniparser.py
@@ -14,70 +14,13 @@
#
from __future__ import absolute_import
+
import unittest
from contextlib import contextmanager
-
import mock
-STL_MOCKS = {
- 'stl': mock.MagicMock(),
- 'stl.trex_stl_lib': mock.MagicMock(),
- 'stl.trex_stl_lib.base64': mock.MagicMock(),
- 'stl.trex_stl_lib.binascii': mock.MagicMock(),
- 'stl.trex_stl_lib.collections': mock.MagicMock(),
- 'stl.trex_stl_lib.copy': mock.MagicMock(),
- 'stl.trex_stl_lib.datetime': mock.MagicMock(),
- 'stl.trex_stl_lib.functools': mock.MagicMock(),
- 'stl.trex_stl_lib.imp': mock.MagicMock(),
- 'stl.trex_stl_lib.inspect': mock.MagicMock(),
- 'stl.trex_stl_lib.json': mock.MagicMock(),
- 'stl.trex_stl_lib.linecache': mock.MagicMock(),
- 'stl.trex_stl_lib.math': mock.MagicMock(),
- 'stl.trex_stl_lib.os': mock.MagicMock(),
- 'stl.trex_stl_lib.platform': mock.MagicMock(),
- 'stl.trex_stl_lib.pprint': mock.MagicMock(),
- 'stl.trex_stl_lib.random': mock.MagicMock(),
- 'stl.trex_stl_lib.re': mock.MagicMock(),
- 'stl.trex_stl_lib.scapy': mock.MagicMock(),
- 'stl.trex_stl_lib.socket': mock.MagicMock(),
- 'stl.trex_stl_lib.string': mock.MagicMock(),
- 'stl.trex_stl_lib.struct': mock.MagicMock(),
- 'stl.trex_stl_lib.sys': mock.MagicMock(),
- 'stl.trex_stl_lib.threading': mock.MagicMock(),
- 'stl.trex_stl_lib.time': mock.MagicMock(),
- 'stl.trex_stl_lib.traceback': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_async_client': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_client': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_exceptions': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_ext': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_jsonrpc_client': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_packet_builder_interface': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_packet_builder_scapy': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_port': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_stats': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_streams': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_types': mock.MagicMock(),
- 'stl.trex_stl_lib.types': mock.MagicMock(),
- 'stl.trex_stl_lib.utils': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.argparse': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.collections': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.common': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.json': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.os': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.parsing_opts': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.pwd': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.random': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.re': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.string': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.sys': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.text_opts': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.text_tables': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.texttable': mock.MagicMock(),
- 'stl.trex_stl_lib.warnings': mock.MagicMock(),
- 'stl.trex_stl_lib.yaml': mock.MagicMock(),
- 'stl.trex_stl_lib.zlib': mock.MagicMock(),
- 'stl.trex_stl_lib.zmq': mock.MagicMock(),
-}
+from tests.unit import STL_MOCKS
+
STLClient = mock.MagicMock()
stl_patch = mock.patch.dict("sys.modules", STL_MOCKS)
diff --git a/tests/unit/network_services/vnf_generic/vnf/test_prox_helpers.py b/tests/unit/network_services/vnf_generic/vnf/test_prox_helpers.py
index 90ec3f374..98eccae4f 100644
--- a/tests/unit/network_services/vnf_generic/vnf/test_prox_helpers.py
+++ b/tests/unit/network_services/vnf_generic/vnf/test_prox_helpers.py
@@ -23,69 +23,10 @@ import unittest
from collections import OrderedDict
from itertools import repeat, chain
from contextlib import contextmanager
-
import mock
+from tests.unit import STL_MOCKS
-STL_MOCKS = {
- 'stl': mock.MagicMock(),
- 'stl.trex_stl_lib': mock.MagicMock(),
- 'stl.trex_stl_lib.base64': mock.MagicMock(),
- 'stl.trex_stl_lib.binascii': mock.MagicMock(),
- 'stl.trex_stl_lib.collections': mock.MagicMock(),
- 'stl.trex_stl_lib.copy': mock.MagicMock(),
- 'stl.trex_stl_lib.datetime': mock.MagicMock(),
- 'stl.trex_stl_lib.functools': mock.MagicMock(),
- 'stl.trex_stl_lib.imp': mock.MagicMock(),
- 'stl.trex_stl_lib.inspect': mock.MagicMock(),
- 'stl.trex_stl_lib.json': mock.MagicMock(),
- 'stl.trex_stl_lib.linecache': mock.MagicMock(),
- 'stl.trex_stl_lib.math': mock.MagicMock(),
- 'stl.trex_stl_lib.os': mock.MagicMock(),
- 'stl.trex_stl_lib.platform': mock.MagicMock(),
- 'stl.trex_stl_lib.pprint': mock.MagicMock(),
- 'stl.trex_stl_lib.random': mock.MagicMock(),
- 'stl.trex_stl_lib.re': mock.MagicMock(),
- 'stl.trex_stl_lib.scapy': mock.MagicMock(),
- 'stl.trex_stl_lib.socket': mock.MagicMock(),
- 'stl.trex_stl_lib.string': mock.MagicMock(),
- 'stl.trex_stl_lib.struct': mock.MagicMock(),
- 'stl.trex_stl_lib.sys': mock.MagicMock(),
- 'stl.trex_stl_lib.threading': mock.MagicMock(),
- 'stl.trex_stl_lib.time': mock.MagicMock(),
- 'stl.trex_stl_lib.traceback': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_async_client': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_client': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_exceptions': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_ext': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_jsonrpc_client': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_packet_builder_interface': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_packet_builder_scapy': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_port': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_stats': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_streams': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_types': mock.MagicMock(),
- 'stl.trex_stl_lib.types': mock.MagicMock(),
- 'stl.trex_stl_lib.utils': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.argparse': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.collections': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.common': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.json': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.os': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.parsing_opts': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.pwd': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.random': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.re': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.string': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.sys': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.text_opts': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.text_tables': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.texttable': mock.MagicMock(),
- 'stl.trex_stl_lib.warnings': mock.MagicMock(),
- 'stl.trex_stl_lib.yaml': mock.MagicMock(),
- 'stl.trex_stl_lib.zlib': mock.MagicMock(),
- 'stl.trex_stl_lib.zmq': mock.MagicMock(),
-}
STLClient = mock.MagicMock()
stl_patch = mock.patch.dict("sys.modules", STL_MOCKS)
diff --git a/tests/unit/network_services/vnf_generic/vnf/test_prox_vnf.py b/tests/unit/network_services/vnf_generic/vnf/test_prox_vnf.py
index 453100b90..c727cb7fb 100644
--- a/tests/unit/network_services/vnf_generic/vnf/test_prox_vnf.py
+++ b/tests/unit/network_services/vnf_generic/vnf/test_prox_vnf.py
@@ -19,71 +19,13 @@ from __future__ import absolute_import
import os
import unittest
-
import mock
from copy import deepcopy
-SSH_HELPER = 'yardstick.network_services.vnf_generic.vnf.sample_vnf.VnfSshHelper'
+from tests.unit import STL_MOCKS
-STL_MOCKS = {
- 'stl': mock.MagicMock(),
- 'stl.trex_stl_lib': mock.MagicMock(),
- 'stl.trex_stl_lib.base64': mock.MagicMock(),
- 'stl.trex_stl_lib.binascii': mock.MagicMock(),
- 'stl.trex_stl_lib.collections': mock.MagicMock(),
- 'stl.trex_stl_lib.copy': mock.MagicMock(),
- 'stl.trex_stl_lib.datetime': mock.MagicMock(),
- 'stl.trex_stl_lib.functools': mock.MagicMock(),
- 'stl.trex_stl_lib.imp': mock.MagicMock(),
- 'stl.trex_stl_lib.inspect': mock.MagicMock(),
- 'stl.trex_stl_lib.json': mock.MagicMock(),
- 'stl.trex_stl_lib.linecache': mock.MagicMock(),
- 'stl.trex_stl_lib.math': mock.MagicMock(),
- 'stl.trex_stl_lib.os': mock.MagicMock(),
- 'stl.trex_stl_lib.platform': mock.MagicMock(),
- 'stl.trex_stl_lib.pprint': mock.MagicMock(),
- 'stl.trex_stl_lib.random': mock.MagicMock(),
- 'stl.trex_stl_lib.re': mock.MagicMock(),
- 'stl.trex_stl_lib.scapy': mock.MagicMock(),
- 'stl.trex_stl_lib.socket': mock.MagicMock(),
- 'stl.trex_stl_lib.string': mock.MagicMock(),
- 'stl.trex_stl_lib.struct': mock.MagicMock(),
- 'stl.trex_stl_lib.sys': mock.MagicMock(),
- 'stl.trex_stl_lib.threading': mock.MagicMock(),
- 'stl.trex_stl_lib.time': mock.MagicMock(),
- 'stl.trex_stl_lib.traceback': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_async_client': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_client': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_exceptions': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_ext': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_jsonrpc_client': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_packet_builder_interface': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_packet_builder_scapy': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_port': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_stats': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_streams': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_types': mock.MagicMock(),
- 'stl.trex_stl_lib.types': mock.MagicMock(),
- 'stl.trex_stl_lib.utils': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.argparse': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.collections': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.common': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.json': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.os': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.parsing_opts': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.pwd': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.random': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.re': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.string': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.sys': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.text_opts': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.text_tables': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.texttable': mock.MagicMock(),
- 'stl.trex_stl_lib.warnings': mock.MagicMock(),
- 'stl.trex_stl_lib.yaml': mock.MagicMock(),
- 'stl.trex_stl_lib.zlib': mock.MagicMock(),
- 'stl.trex_stl_lib.zmq': mock.MagicMock(),
-}
+
+SSH_HELPER = 'yardstick.network_services.vnf_generic.vnf.sample_vnf.VnfSshHelper'
STLClient = mock.MagicMock()
stl_patch = mock.patch.dict("sys.modules", STL_MOCKS)
diff --git a/tests/unit/network_services/vnf_generic/vnf/test_sample_vnf.py b/tests/unit/network_services/vnf_generic/vnf/test_sample_vnf.py
index 07a862a8e..455e44ec9 100644
--- a/tests/unit/network_services/vnf_generic/vnf/test_sample_vnf.py
+++ b/tests/unit/network_services/vnf_generic/vnf/test_sample_vnf.py
@@ -18,11 +18,13 @@
# Unittest for yardstick.network_services.vnf_generic.vnf.sample_vnf
from __future__ import absolute_import
+
import unittest
import mock
from copy import deepcopy
from tests.unit.network_services.vnf_generic.vnf.test_base import mock_ssh
+from tests.unit import STL_MOCKS
from yardstick.benchmark.contexts.base import Context
from yardstick.network_services.nfvi.resource import ResourceProfile
from yardstick.network_services.traffic_profile.base import TrafficProfile
@@ -34,66 +36,6 @@ class MockError(BaseException):
pass
-STL_MOCKS = {
- 'stl': mock.MagicMock(),
- 'stl.trex_stl_lib': mock.MagicMock(),
- 'stl.trex_stl_lib.base64': mock.MagicMock(),
- 'stl.trex_stl_lib.binascii': mock.MagicMock(),
- 'stl.trex_stl_lib.collections': mock.MagicMock(),
- 'stl.trex_stl_lib.copy': mock.MagicMock(),
- 'stl.trex_stl_lib.datetime': mock.MagicMock(),
- 'stl.trex_stl_lib.functools': mock.MagicMock(),
- 'stl.trex_stl_lib.imp': mock.MagicMock(),
- 'stl.trex_stl_lib.inspect': mock.MagicMock(),
- 'stl.trex_stl_lib.json': mock.MagicMock(),
- 'stl.trex_stl_lib.linecache': mock.MagicMock(),
- 'stl.trex_stl_lib.math': mock.MagicMock(),
- 'stl.trex_stl_lib.os': mock.MagicMock(),
- 'stl.trex_stl_lib.platform': mock.MagicMock(),
- 'stl.trex_stl_lib.pprint': mock.MagicMock(),
- 'stl.trex_stl_lib.random': mock.MagicMock(),
- 'stl.trex_stl_lib.re': mock.MagicMock(),
- 'stl.trex_stl_lib.scapy': mock.MagicMock(),
- 'stl.trex_stl_lib.socket': mock.MagicMock(),
- 'stl.trex_stl_lib.string': mock.MagicMock(),
- 'stl.trex_stl_lib.struct': mock.MagicMock(),
- 'stl.trex_stl_lib.sys': mock.MagicMock(),
- 'stl.trex_stl_lib.threading': mock.MagicMock(),
- 'stl.trex_stl_lib.time': mock.MagicMock(),
- 'stl.trex_stl_lib.traceback': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_async_client': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_client': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_exceptions': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_ext': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_jsonrpc_client': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_packet_builder_interface': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_packet_builder_scapy': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_port': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_stats': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_streams': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_types': mock.MagicMock(),
- 'stl.trex_stl_lib.types': mock.MagicMock(),
- 'stl.trex_stl_lib.utils': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.argparse': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.collections': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.common': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.json': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.os': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.parsing_opts': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.pwd': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.random': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.re': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.string': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.sys': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.text_opts': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.text_tables': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.texttable': mock.MagicMock(),
- 'stl.trex_stl_lib.warnings': mock.MagicMock(),
- 'stl.trex_stl_lib.yaml': mock.MagicMock(),
- 'stl.trex_stl_lib.zlib': mock.MagicMock(),
- 'stl.trex_stl_lib.zmq': mock.MagicMock(),
-}
-
STLClient = mock.MagicMock()
stl_patch = mock.patch.dict("sys.modules", STL_MOCKS)
stl_patch.start()
diff --git a/tests/unit/network_services/vnf_generic/vnf/test_tg_ixload.py b/tests/unit/network_services/vnf_generic/vnf/test_tg_ixload.py
index cda44127e..5c81aa886 100644
--- a/tests/unit/network_services/vnf_generic/vnf/test_tg_ixload.py
+++ b/tests/unit/network_services/vnf_generic/vnf/test_tg_ixload.py
@@ -16,69 +16,13 @@
#
from __future__ import absolute_import
+
import unittest
import mock
import subprocess
-STL_MOCKS = {
- 'stl': mock.MagicMock(),
- 'stl.trex_stl_lib': mock.MagicMock(),
- 'stl.trex_stl_lib.base64': mock.MagicMock(),
- 'stl.trex_stl_lib.binascii': mock.MagicMock(),
- 'stl.trex_stl_lib.collections': mock.MagicMock(),
- 'stl.trex_stl_lib.copy': mock.MagicMock(),
- 'stl.trex_stl_lib.datetime': mock.MagicMock(),
- 'stl.trex_stl_lib.functools': mock.MagicMock(),
- 'stl.trex_stl_lib.imp': mock.MagicMock(),
- 'stl.trex_stl_lib.inspect': mock.MagicMock(),
- 'stl.trex_stl_lib.json': mock.MagicMock(),
- 'stl.trex_stl_lib.linecache': mock.MagicMock(),
- 'stl.trex_stl_lib.math': mock.MagicMock(),
- 'stl.trex_stl_lib.os': mock.MagicMock(),
- 'stl.trex_stl_lib.platform': mock.MagicMock(),
- 'stl.trex_stl_lib.pprint': mock.MagicMock(),
- 'stl.trex_stl_lib.random': mock.MagicMock(),
- 'stl.trex_stl_lib.re': mock.MagicMock(),
- 'stl.trex_stl_lib.scapy': mock.MagicMock(),
- 'stl.trex_stl_lib.socket': mock.MagicMock(),
- 'stl.trex_stl_lib.string': mock.MagicMock(),
- 'stl.trex_stl_lib.struct': mock.MagicMock(),
- 'stl.trex_stl_lib.sys': mock.MagicMock(),
- 'stl.trex_stl_lib.threading': mock.MagicMock(),
- 'stl.trex_stl_lib.time': mock.MagicMock(),
- 'stl.trex_stl_lib.traceback': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_async_client': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_client': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_exceptions': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_ext': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_jsonrpc_client': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_packet_builder_interface': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_packet_builder_scapy': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_port': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_stats': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_streams': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_types': mock.MagicMock(),
- 'stl.trex_stl_lib.types': mock.MagicMock(),
- 'stl.trex_stl_lib.utils': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.argparse': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.collections': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.common': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.json': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.os': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.parsing_opts': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.pwd': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.random': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.re': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.string': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.sys': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.text_opts': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.text_tables': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.texttable': mock.MagicMock(),
- 'stl.trex_stl_lib.warnings': mock.MagicMock(),
- 'stl.trex_stl_lib.yaml': mock.MagicMock(),
- 'stl.trex_stl_lib.zlib': mock.MagicMock(),
- 'stl.trex_stl_lib.zmq': mock.MagicMock(),
-}
+from tests.unit import STL_MOCKS
+
STLClient = mock.MagicMock()
stl_patch = mock.patch.dict("sys.modules", STL_MOCKS)
diff --git a/tests/unit/network_services/vnf_generic/vnf/test_tg_ping.py b/tests/unit/network_services/vnf_generic/vnf/test_tg_ping.py
index 949bfb3d4..45bbfaea3 100644
--- a/tests/unit/network_services/vnf_generic/vnf/test_tg_ping.py
+++ b/tests/unit/network_services/vnf_generic/vnf/test_tg_ping.py
@@ -16,74 +16,16 @@
#
from __future__ import absolute_import
+
import unittest
import mock
from multiprocessing import Queue
from tests.unit.network_services.vnf_generic.vnf.test_base import mock_ssh
+from tests.unit import STL_MOCKS
SSH_HELPER = "yardstick.network_services.vnf_generic.vnf.sample_vnf.VnfSshHelper"
-STL_MOCKS = {
- 'stl': mock.MagicMock(),
- 'stl.trex_stl_lib': mock.MagicMock(),
- 'stl.trex_stl_lib.base64': mock.MagicMock(),
- 'stl.trex_stl_lib.binascii': mock.MagicMock(),
- 'stl.trex_stl_lib.collections': mock.MagicMock(),
- 'stl.trex_stl_lib.copy': mock.MagicMock(),
- 'stl.trex_stl_lib.datetime': mock.MagicMock(),
- 'stl.trex_stl_lib.functools': mock.MagicMock(),
- 'stl.trex_stl_lib.imp': mock.MagicMock(),
- 'stl.trex_stl_lib.inspect': mock.MagicMock(),
- 'stl.trex_stl_lib.json': mock.MagicMock(),
- 'stl.trex_stl_lib.linecache': mock.MagicMock(),
- 'stl.trex_stl_lib.math': mock.MagicMock(),
- 'stl.trex_stl_lib.os': mock.MagicMock(),
- 'stl.trex_stl_lib.platform': mock.MagicMock(),
- 'stl.trex_stl_lib.pprint': mock.MagicMock(),
- 'stl.trex_stl_lib.random': mock.MagicMock(),
- 'stl.trex_stl_lib.re': mock.MagicMock(),
- 'stl.trex_stl_lib.scapy': mock.MagicMock(),
- 'stl.trex_stl_lib.socket': mock.MagicMock(),
- 'stl.trex_stl_lib.string': mock.MagicMock(),
- 'stl.trex_stl_lib.struct': mock.MagicMock(),
- 'stl.trex_stl_lib.sys': mock.MagicMock(),
- 'stl.trex_stl_lib.threading': mock.MagicMock(),
- 'stl.trex_stl_lib.time': mock.MagicMock(),
- 'stl.trex_stl_lib.traceback': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_async_client': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_client': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_exceptions': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_ext': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_jsonrpc_client': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_packet_builder_interface': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_packet_builder_scapy': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_port': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_stats': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_streams': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_types': mock.MagicMock(),
- 'stl.trex_stl_lib.types': mock.MagicMock(),
- 'stl.trex_stl_lib.utils': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.argparse': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.collections': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.common': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.json': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.os': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.parsing_opts': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.pwd': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.random': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.re': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.string': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.sys': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.text_opts': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.text_tables': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.texttable': mock.MagicMock(),
- 'stl.trex_stl_lib.warnings': mock.MagicMock(),
- 'stl.trex_stl_lib.yaml': mock.MagicMock(),
- 'stl.trex_stl_lib.zlib': mock.MagicMock(),
- 'stl.trex_stl_lib.zmq': mock.MagicMock(),
-}
-
STLClient = mock.MagicMock()
stl_patch = mock.patch.dict("sys.modules", STL_MOCKS)
stl_patch.start()
diff --git a/tests/unit/network_services/vnf_generic/vnf/test_tg_prox.py b/tests/unit/network_services/vnf_generic/vnf/test_tg_prox.py
index 1a01b9e15..12abadf98 100644
--- a/tests/unit/network_services/vnf_generic/vnf/test_tg_prox.py
+++ b/tests/unit/network_services/vnf_generic/vnf/test_tg_prox.py
@@ -14,76 +14,17 @@
#
from __future__ import absolute_import
+
import unittest
import mock
from tests.unit.network_services.vnf_generic.vnf.test_base import mock_ssh
+from tests.unit import STL_MOCKS
SSH_HELPER = 'yardstick.network_services.vnf_generic.vnf.sample_vnf.VnfSshHelper'
NAME = 'vnf__1'
-
-STL_MOCKS = {
- 'stl': mock.MagicMock(),
- 'stl.trex_stl_lib': mock.MagicMock(),
- 'stl.trex_stl_lib.base64': mock.MagicMock(),
- 'stl.trex_stl_lib.binascii': mock.MagicMock(),
- 'stl.trex_stl_lib.collections': mock.MagicMock(),
- 'stl.trex_stl_lib.copy': mock.MagicMock(),
- 'stl.trex_stl_lib.datetime': mock.MagicMock(),
- 'stl.trex_stl_lib.functools': mock.MagicMock(),
- 'stl.trex_stl_lib.imp': mock.MagicMock(),
- 'stl.trex_stl_lib.inspect': mock.MagicMock(),
- 'stl.trex_stl_lib.json': mock.MagicMock(),
- 'stl.trex_stl_lib.linecache': mock.MagicMock(),
- 'stl.trex_stl_lib.math': mock.MagicMock(),
- 'stl.trex_stl_lib.os': mock.MagicMock(),
- 'stl.trex_stl_lib.platform': mock.MagicMock(),
- 'stl.trex_stl_lib.pprint': mock.MagicMock(),
- 'stl.trex_stl_lib.random': mock.MagicMock(),
- 'stl.trex_stl_lib.re': mock.MagicMock(),
- 'stl.trex_stl_lib.scapy': mock.MagicMock(),
- 'stl.trex_stl_lib.socket': mock.MagicMock(),
- 'stl.trex_stl_lib.string': mock.MagicMock(),
- 'stl.trex_stl_lib.struct': mock.MagicMock(),
- 'stl.trex_stl_lib.sys': mock.MagicMock(),
- 'stl.trex_stl_lib.threading': mock.MagicMock(),
- 'stl.trex_stl_lib.time': mock.MagicMock(),
- 'stl.trex_stl_lib.traceback': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_async_client': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_client': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_exceptions': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_ext': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_jsonrpc_client': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_packet_builder_interface': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_packet_builder_scapy': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_port': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_stats': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_streams': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_types': mock.MagicMock(),
- 'stl.trex_stl_lib.types': mock.MagicMock(),
- 'stl.trex_stl_lib.utils': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.argparse': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.collections': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.common': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.json': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.os': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.parsing_opts': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.pwd': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.random': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.re': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.string': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.sys': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.text_opts': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.text_tables': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.texttable': mock.MagicMock(),
- 'stl.trex_stl_lib.warnings': mock.MagicMock(),
- 'stl.trex_stl_lib.yaml': mock.MagicMock(),
- 'stl.trex_stl_lib.zlib': mock.MagicMock(),
- 'stl.trex_stl_lib.zmq': mock.MagicMock(),
-}
-
STLClient = mock.MagicMock()
stl_patch = mock.patch.dict("sys.modules", STL_MOCKS)
stl_patch.start()
diff --git a/tests/unit/network_services/vnf_generic/vnf/test_tg_rfc2544_ixia.py b/tests/unit/network_services/vnf_generic/vnf/test_tg_rfc2544_ixia.py
index 8f7f05772..ca8150cb2 100644
--- a/tests/unit/network_services/vnf_generic/vnf/test_tg_rfc2544_ixia.py
+++ b/tests/unit/network_services/vnf_generic/vnf/test_tg_rfc2544_ixia.py
@@ -16,68 +16,13 @@
#
from __future__ import absolute_import
+
import os
import unittest
import mock
-STL_MOCKS = {
- 'stl': mock.MagicMock(),
- 'stl.trex_stl_lib': mock.MagicMock(),
- 'stl.trex_stl_lib.base64': mock.MagicMock(),
- 'stl.trex_stl_lib.binascii': mock.MagicMock(),
- 'stl.trex_stl_lib.collections': mock.MagicMock(),
- 'stl.trex_stl_lib.copy': mock.MagicMock(),
- 'stl.trex_stl_lib.datetime': mock.MagicMock(),
- 'stl.trex_stl_lib.functools': mock.MagicMock(),
- 'stl.trex_stl_lib.imp': mock.MagicMock(),
- 'stl.trex_stl_lib.inspect': mock.MagicMock(),
- 'stl.trex_stl_lib.json': mock.MagicMock(),
- 'stl.trex_stl_lib.linecache': mock.MagicMock(),
- 'stl.trex_stl_lib.math': mock.MagicMock(),
- 'stl.trex_stl_lib.os': mock.MagicMock(),
- 'stl.trex_stl_lib.platform': mock.MagicMock(),
- 'stl.trex_stl_lib.pprint': mock.MagicMock(),
- 'stl.trex_stl_lib.random': mock.MagicMock(),
- 'stl.trex_stl_lib.re': mock.MagicMock(),
- 'stl.trex_stl_lib.scapy': mock.MagicMock(),
- 'stl.trex_stl_lib.socket': mock.MagicMock(),
- 'stl.trex_stl_lib.string': mock.MagicMock(),
- 'stl.trex_stl_lib.struct': mock.MagicMock(),
- 'stl.trex_stl_lib.sys': mock.MagicMock(),
- 'stl.trex_stl_lib.threading': mock.MagicMock(),
- 'stl.trex_stl_lib.time': mock.MagicMock(),
- 'stl.trex_stl_lib.traceback': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_async_client': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_client': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_exceptions': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_ext': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_jsonrpc_client': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_packet_builder_interface': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_packet_builder_scapy': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_port': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_stats': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_streams': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_types': mock.MagicMock(),
- 'stl.trex_stl_lib.types': mock.MagicMock(),
- 'stl.trex_stl_lib.utils': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.argparse': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.collections': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.common': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.json': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.os': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.parsing_opts': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.pwd': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.random': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.re': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.string': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.sys': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.text_opts': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.text_tables': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.texttable': mock.MagicMock(),
- 'stl.trex_stl_lib.warnings': mock.MagicMock(),
- 'stl.trex_stl_lib.yaml': mock.MagicMock(),
- 'stl.trex_stl_lib.zlib': mock.MagicMock(),
- 'stl.trex_stl_lib.zmq': mock.MagicMock(),
-}
+
+from tests.unit import STL_MOCKS
+
STLClient = mock.MagicMock()
stl_patch = mock.patch.dict("sys.modules", STL_MOCKS)
diff --git a/tests/unit/network_services/vnf_generic/vnf/test_tg_rfc2544_trex.py b/tests/unit/network_services/vnf_generic/vnf/test_tg_rfc2544_trex.py
index 7dc303852..3dcb02f02 100644
--- a/tests/unit/network_services/vnf_generic/vnf/test_tg_rfc2544_trex.py
+++ b/tests/unit/network_services/vnf_generic/vnf/test_tg_rfc2544_trex.py
@@ -16,70 +16,14 @@
#
from __future__ import absolute_import
+
import unittest
import mock
-SSH_HELPER = "yardstick.ssh.SSH"
+from tests.unit import STL_MOCKS
-STL_MOCKS = {
- 'stl': mock.MagicMock(),
- 'stl.trex_stl_lib': mock.MagicMock(),
- 'stl.trex_stl_lib.base64': mock.MagicMock(),
- 'stl.trex_stl_lib.binascii': mock.MagicMock(),
- 'stl.trex_stl_lib.collections': mock.MagicMock(),
- 'stl.trex_stl_lib.copy': mock.MagicMock(),
- 'stl.trex_stl_lib.datetime': mock.MagicMock(),
- 'stl.trex_stl_lib.functools': mock.MagicMock(),
- 'stl.trex_stl_lib.imp': mock.MagicMock(),
- 'stl.trex_stl_lib.inspect': mock.MagicMock(),
- 'stl.trex_stl_lib.json': mock.MagicMock(),
- 'stl.trex_stl_lib.linecache': mock.MagicMock(),
- 'stl.trex_stl_lib.math': mock.MagicMock(),
- 'stl.trex_stl_lib.os': mock.MagicMock(),
- 'stl.trex_stl_lib.platform': mock.MagicMock(),
- 'stl.trex_stl_lib.pprint': mock.MagicMock(),
- 'stl.trex_stl_lib.random': mock.MagicMock(),
- 'stl.trex_stl_lib.re': mock.MagicMock(),
- 'stl.trex_stl_lib.scapy': mock.MagicMock(),
- 'stl.trex_stl_lib.socket': mock.MagicMock(),
- 'stl.trex_stl_lib.string': mock.MagicMock(),
- 'stl.trex_stl_lib.struct': mock.MagicMock(),
- 'stl.trex_stl_lib.sys': mock.MagicMock(),
- 'stl.trex_stl_lib.threading': mock.MagicMock(),
- 'stl.trex_stl_lib.time': mock.MagicMock(),
- 'stl.trex_stl_lib.traceback': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_async_client': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_client': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_exceptions': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_ext': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_jsonrpc_client': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_packet_builder_interface': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_packet_builder_scapy': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_port': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_stats': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_streams': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_types': mock.MagicMock(),
- 'stl.trex_stl_lib.types': mock.MagicMock(),
- 'stl.trex_stl_lib.utils': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.argparse': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.collections': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.common': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.json': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.os': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.parsing_opts': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.pwd': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.random': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.re': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.string': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.sys': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.text_opts': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.text_tables': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.texttable': mock.MagicMock(),
- 'stl.trex_stl_lib.warnings': mock.MagicMock(),
- 'stl.trex_stl_lib.yaml': mock.MagicMock(),
- 'stl.trex_stl_lib.zlib': mock.MagicMock(),
- 'stl.trex_stl_lib.zmq': mock.MagicMock(),
-}
+
+SSH_HELPER = "yardstick.ssh.SSH"
STLClient = mock.MagicMock()
stl_patch = mock.patch.dict("sys.modules", STL_MOCKS)
diff --git a/tests/unit/network_services/vnf_generic/vnf/test_tg_trex.py b/tests/unit/network_services/vnf_generic/vnf/test_tg_trex.py
index 6fb5d080f..65370dfa5 100644
--- a/tests/unit/network_services/vnf_generic/vnf/test_tg_trex.py
+++ b/tests/unit/network_services/vnf_generic/vnf/test_tg_trex.py
@@ -16,74 +16,16 @@
#
from __future__ import absolute_import
+
import unittest
import mock
from tests.unit.network_services.vnf_generic.vnf.test_base import mock_ssh
+from tests.unit import STL_MOCKS
NAME = 'vnf_1'
-STL_MOCKS = {
- 'stl': mock.MagicMock(),
- 'stl.trex_stl_lib': mock.MagicMock(),
- 'stl.trex_stl_lib.base64': mock.MagicMock(),
- 'stl.trex_stl_lib.binascii': mock.MagicMock(),
- 'stl.trex_stl_lib.collections': mock.MagicMock(),
- 'stl.trex_stl_lib.copy': mock.MagicMock(),
- 'stl.trex_stl_lib.datetime': mock.MagicMock(),
- 'stl.trex_stl_lib.functools': mock.MagicMock(),
- 'stl.trex_stl_lib.imp': mock.MagicMock(),
- 'stl.trex_stl_lib.inspect': mock.MagicMock(),
- 'stl.trex_stl_lib.json': mock.MagicMock(),
- 'stl.trex_stl_lib.linecache': mock.MagicMock(),
- 'stl.trex_stl_lib.math': mock.MagicMock(),
- 'stl.trex_stl_lib.os': mock.MagicMock(),
- 'stl.trex_stl_lib.platform': mock.MagicMock(),
- 'stl.trex_stl_lib.pprint': mock.MagicMock(),
- 'stl.trex_stl_lib.random': mock.MagicMock(),
- 'stl.trex_stl_lib.re': mock.MagicMock(),
- 'stl.trex_stl_lib.scapy': mock.MagicMock(),
- 'stl.trex_stl_lib.socket': mock.MagicMock(),
- 'stl.trex_stl_lib.string': mock.MagicMock(),
- 'stl.trex_stl_lib.struct': mock.MagicMock(),
- 'stl.trex_stl_lib.sys': mock.MagicMock(),
- 'stl.trex_stl_lib.threading': mock.MagicMock(),
- 'stl.trex_stl_lib.time': mock.MagicMock(),
- 'stl.trex_stl_lib.traceback': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_async_client': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_client': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_exceptions': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_ext': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_jsonrpc_client': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_packet_builder_interface': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_packet_builder_scapy': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_port': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_stats': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_streams': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_types': mock.MagicMock(),
- 'stl.trex_stl_lib.types': mock.MagicMock(),
- 'stl.trex_stl_lib.utils': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.argparse': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.collections': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.common': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.json': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.os': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.parsing_opts': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.pwd': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.random': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.re': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.string': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.sys': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.text_opts': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.text_tables': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.texttable': mock.MagicMock(),
- 'stl.trex_stl_lib.warnings': mock.MagicMock(),
- 'stl.trex_stl_lib.yaml': mock.MagicMock(),
- 'stl.trex_stl_lib.zlib': mock.MagicMock(),
- 'stl.trex_stl_lib.zmq': mock.MagicMock(),
-}
-
STLClient = mock.MagicMock()
stl_patch = mock.patch.dict("sys.modules", STL_MOCKS)
stl_patch.start()
diff --git a/tests/unit/network_services/vnf_generic/vnf/test_udp_replay.py b/tests/unit/network_services/vnf_generic/vnf/test_udp_replay.py
index 08bf06b74..f0d75d57b 100644
--- a/tests/unit/network_services/vnf_generic/vnf/test_udp_replay.py
+++ b/tests/unit/network_services/vnf_generic/vnf/test_udp_replay.py
@@ -16,70 +16,13 @@
#
from __future__ import absolute_import
+
import unittest
import mock
import os
+from tests.unit import STL_MOCKS
-STL_MOCKS = {
- 'stl': mock.MagicMock(),
- 'stl.trex_stl_lib': mock.MagicMock(),
- 'stl.trex_stl_lib.base64': mock.MagicMock(),
- 'stl.trex_stl_lib.binascii': mock.MagicMock(),
- 'stl.trex_stl_lib.collections': mock.MagicMock(),
- 'stl.trex_stl_lib.copy': mock.MagicMock(),
- 'stl.trex_stl_lib.datetime': mock.MagicMock(),
- 'stl.trex_stl_lib.functools': mock.MagicMock(),
- 'stl.trex_stl_lib.imp': mock.MagicMock(),
- 'stl.trex_stl_lib.inspect': mock.MagicMock(),
- 'stl.trex_stl_lib.json': mock.MagicMock(),
- 'stl.trex_stl_lib.linecache': mock.MagicMock(),
- 'stl.trex_stl_lib.math': mock.MagicMock(),
- 'stl.trex_stl_lib.os': mock.MagicMock(),
- 'stl.trex_stl_lib.platform': mock.MagicMock(),
- 'stl.trex_stl_lib.pprint': mock.MagicMock(),
- 'stl.trex_stl_lib.random': mock.MagicMock(),
- 'stl.trex_stl_lib.re': mock.MagicMock(),
- 'stl.trex_stl_lib.scapy': mock.MagicMock(),
- 'stl.trex_stl_lib.socket': mock.MagicMock(),
- 'stl.trex_stl_lib.string': mock.MagicMock(),
- 'stl.trex_stl_lib.struct': mock.MagicMock(),
- 'stl.trex_stl_lib.sys': mock.MagicMock(),
- 'stl.trex_stl_lib.threading': mock.MagicMock(),
- 'stl.trex_stl_lib.time': mock.MagicMock(),
- 'stl.trex_stl_lib.traceback': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_async_client': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_client': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_exceptions': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_ext': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_jsonrpc_client': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_packet_builder_interface': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_packet_builder_scapy': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_port': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_stats': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_streams': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_types': mock.MagicMock(),
- 'stl.trex_stl_lib.types': mock.MagicMock(),
- 'stl.trex_stl_lib.utils': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.argparse': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.collections': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.common': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.json': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.os': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.parsing_opts': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.pwd': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.random': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.re': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.string': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.sys': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.text_opts': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.text_tables': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.texttable': mock.MagicMock(),
- 'stl.trex_stl_lib.warnings': mock.MagicMock(),
- 'stl.trex_stl_lib.yaml': mock.MagicMock(),
- 'stl.trex_stl_lib.zlib': mock.MagicMock(),
- 'stl.trex_stl_lib.zmq': mock.MagicMock(),
-}
STLClient = mock.MagicMock()
stl_patch = mock.patch.dict("sys.modules", STL_MOCKS)
diff --git a/tests/unit/network_services/vnf_generic/vnf/test_vfw_vnf.py b/tests/unit/network_services/vnf_generic/vnf/test_vfw_vnf.py
index d817b164c..7dae89f40 100644
--- a/tests/unit/network_services/vnf_generic/vnf/test_vfw_vnf.py
+++ b/tests/unit/network_services/vnf_generic/vnf/test_vfw_vnf.py
@@ -16,69 +16,13 @@
#
from __future__ import absolute_import
+
import unittest
import mock
import os
-STL_MOCKS = {
- 'stl': mock.MagicMock(),
- 'stl.trex_stl_lib': mock.MagicMock(),
- 'stl.trex_stl_lib.base64': mock.MagicMock(),
- 'stl.trex_stl_lib.binascii': mock.MagicMock(),
- 'stl.trex_stl_lib.collections': mock.MagicMock(),
- 'stl.trex_stl_lib.copy': mock.MagicMock(),
- 'stl.trex_stl_lib.datetime': mock.MagicMock(),
- 'stl.trex_stl_lib.functools': mock.MagicMock(),
- 'stl.trex_stl_lib.imp': mock.MagicMock(),
- 'stl.trex_stl_lib.inspect': mock.MagicMock(),
- 'stl.trex_stl_lib.json': mock.MagicMock(),
- 'stl.trex_stl_lib.linecache': mock.MagicMock(),
- 'stl.trex_stl_lib.math': mock.MagicMock(),
- 'stl.trex_stl_lib.os': mock.MagicMock(),
- 'stl.trex_stl_lib.platform': mock.MagicMock(),
- 'stl.trex_stl_lib.pprint': mock.MagicMock(),
- 'stl.trex_stl_lib.random': mock.MagicMock(),
- 'stl.trex_stl_lib.re': mock.MagicMock(),
- 'stl.trex_stl_lib.scapy': mock.MagicMock(),
- 'stl.trex_stl_lib.socket': mock.MagicMock(),
- 'stl.trex_stl_lib.string': mock.MagicMock(),
- 'stl.trex_stl_lib.struct': mock.MagicMock(),
- 'stl.trex_stl_lib.sys': mock.MagicMock(),
- 'stl.trex_stl_lib.threading': mock.MagicMock(),
- 'stl.trex_stl_lib.time': mock.MagicMock(),
- 'stl.trex_stl_lib.traceback': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_async_client': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_client': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_exceptions': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_ext': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_jsonrpc_client': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_packet_builder_interface': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_packet_builder_scapy': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_port': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_stats': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_streams': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_types': mock.MagicMock(),
- 'stl.trex_stl_lib.types': mock.MagicMock(),
- 'stl.trex_stl_lib.utils': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.argparse': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.collections': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.common': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.json': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.os': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.parsing_opts': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.pwd': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.random': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.re': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.string': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.sys': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.text_opts': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.text_tables': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.texttable': mock.MagicMock(),
- 'stl.trex_stl_lib.warnings': mock.MagicMock(),
- 'stl.trex_stl_lib.yaml': mock.MagicMock(),
- 'stl.trex_stl_lib.zlib': mock.MagicMock(),
- 'stl.trex_stl_lib.zmq': mock.MagicMock(),
-}
+from tests.unit import STL_MOCKS
+
STLClient = mock.MagicMock()
stl_patch = mock.patch.dict("sys.modules", STL_MOCKS)
diff --git a/tests/unit/network_services/vnf_generic/vnf/test_vpe_vnf.py b/tests/unit/network_services/vnf_generic/vnf/test_vpe_vnf.py
index 80b4a5108..5e66390e3 100644
--- a/tests/unit/network_services/vnf_generic/vnf/test_vpe_vnf.py
+++ b/tests/unit/network_services/vnf_generic/vnf/test_vpe_vnf.py
@@ -16,77 +16,18 @@
#
from __future__ import absolute_import
+import six.moves.configparser as configparser
import os
import unittest
-
-import six.moves.configparser as configparser
import mock
from multiprocessing import Process, Queue
+from tests.unit import STL_MOCKS
from yardstick.network_services.vnf_generic.vnf.base import QueueFileWrapper
-SSH_HELPER = 'yardstick.network_services.vnf_generic.vnf.sample_vnf.VnfSshHelper'
-STL_MOCKS = {
- 'stl': mock.MagicMock(),
- 'stl.trex_stl_lib': mock.MagicMock(),
- 'stl.trex_stl_lib.base64': mock.MagicMock(),
- 'stl.trex_stl_lib.binascii': mock.MagicMock(),
- 'stl.trex_stl_lib.collections': mock.MagicMock(),
- 'stl.trex_stl_lib.copy': mock.MagicMock(),
- 'stl.trex_stl_lib.datetime': mock.MagicMock(),
- 'stl.trex_stl_lib.functools': mock.MagicMock(),
- 'stl.trex_stl_lib.imp': mock.MagicMock(),
- 'stl.trex_stl_lib.inspect': mock.MagicMock(),
- 'stl.trex_stl_lib.json': mock.MagicMock(),
- 'stl.trex_stl_lib.linecache': mock.MagicMock(),
- 'stl.trex_stl_lib.math': mock.MagicMock(),
- 'stl.trex_stl_lib.os': mock.MagicMock(),
- 'stl.trex_stl_lib.platform': mock.MagicMock(),
- 'stl.trex_stl_lib.pprint': mock.MagicMock(),
- 'stl.trex_stl_lib.random': mock.MagicMock(),
- 'stl.trex_stl_lib.re': mock.MagicMock(),
- 'stl.trex_stl_lib.scapy': mock.MagicMock(),
- 'stl.trex_stl_lib.socket': mock.MagicMock(),
- 'stl.trex_stl_lib.string': mock.MagicMock(),
- 'stl.trex_stl_lib.struct': mock.MagicMock(),
- 'stl.trex_stl_lib.sys': mock.MagicMock(),
- 'stl.trex_stl_lib.threading': mock.MagicMock(),
- 'stl.trex_stl_lib.time': mock.MagicMock(),
- 'stl.trex_stl_lib.traceback': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_async_client': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_client': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_exceptions': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_ext': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_jsonrpc_client': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_packet_builder_interface': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_packet_builder_scapy': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_port': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_stats': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_streams': mock.MagicMock(),
- 'stl.trex_stl_lib.trex_stl_types': mock.MagicMock(),
- 'stl.trex_stl_lib.types': mock.MagicMock(),
- 'stl.trex_stl_lib.utils': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.argparse': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.collections': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.common': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.json': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.os': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.parsing_opts': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.pwd': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.random': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.re': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.string': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.sys': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.text_opts': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.text_tables': mock.MagicMock(),
- 'stl.trex_stl_lib.utils.texttable': mock.MagicMock(),
- 'stl.trex_stl_lib.warnings': mock.MagicMock(),
- 'stl.trex_stl_lib.yaml': mock.MagicMock(),
- 'stl.trex_stl_lib.zlib': mock.MagicMock(),
- 'stl.trex_stl_lib.zmq': mock.MagicMock(),
-}
+SSH_HELPER = 'yardstick.network_services.vnf_generic.vnf.sample_vnf.VnfSshHelper'
STLClient = mock.MagicMock()
stl_patch = mock.patch.dict("sys.modules", STL_MOCKS)
diff --git a/yardstick/benchmark/scenarios/networking/vnf_generic.py b/yardstick/benchmark/scenarios/networking/vnf_generic.py
index 18a75d070..aecc228bc 100644
--- a/yardstick/benchmark/scenarios/networking/vnf_generic.py
+++ b/yardstick/benchmark/scenarios/networking/vnf_generic.py
@@ -14,13 +14,13 @@
""" NSPerf specific scenario definition """
from __future__ import absolute_import
-import logging
+import logging
import errno
import ipaddress
import os
-
+import sys
import re
from itertools import chain
@@ -35,8 +35,10 @@ from yardstick.network_services.collector.subscriber import Collector
from yardstick.network_services.vnf_generic import vnfdgen
from yardstick.network_services.vnf_generic.vnf.base import GenericVNF
from yardstick.network_services.traffic_profile.base import TrafficProfile
+from yardstick.network_services.utils import get_nsb_option
from yardstick import ssh
+
LOG = logging.getLogger(__name__)
@@ -439,6 +441,9 @@ printf "%s/driver:" $1 ; basename $(readlink -s $1/device/driver); } \
:param context_cfg:
:return:
"""
+ trex_lib_path = get_nsb_option('trex_client_lib')
+ sys.path[:] = list(chain([trex_lib_path], (x for x in sys.path if x != trex_lib_path)))
+
if scenario_cfg is None:
scenario_cfg = self.scenario_cfg
diff --git a/yardstick/network_services/traffic_profile/fixed.py b/yardstick/network_services/traffic_profile/fixed.py
index ebc1e61f2..b7cd03773 100644
--- a/yardstick/network_services/traffic_profile/fixed.py
+++ b/yardstick/network_services/traffic_profile/fixed.py
@@ -16,10 +16,10 @@
from __future__ import absolute_import
from yardstick.network_services.traffic_profile.base import TrafficProfile
-from stl.trex_stl_lib.trex_stl_streams import STLTXCont
-from stl.trex_stl_lib.trex_stl_client import STLStream
-from stl.trex_stl_lib.trex_stl_packet_builder_scapy import STLPktBuilder
-from stl.trex_stl_lib import api as Pkt
+from trex_stl_lib.trex_stl_streams import STLTXCont
+from trex_stl_lib.trex_stl_client import STLStream
+from trex_stl_lib.trex_stl_packet_builder_scapy import STLPktBuilder
+from trex_stl_lib import api as Pkt
class FixedProfile(TrafficProfile):
diff --git a/yardstick/network_services/traffic_profile/rfc2544.py b/yardstick/network_services/traffic_profile/rfc2544.py
index b07bc9d5a..a3b803673 100644
--- a/yardstick/network_services/traffic_profile/rfc2544.py
+++ b/yardstick/network_services/traffic_profile/rfc2544.py
@@ -17,9 +17,9 @@ from __future__ import absolute_import
from __future__ import division
import logging
-from stl.trex_stl_lib.trex_stl_client import STLStream
-from stl.trex_stl_lib.trex_stl_streams import STLFlowLatencyStats
-from stl.trex_stl_lib.trex_stl_streams import STLTXCont
+from trex_stl_lib.trex_stl_client import STLStream
+from trex_stl_lib.trex_stl_streams import STLFlowLatencyStats
+from trex_stl_lib.trex_stl_streams import STLTXCont
from yardstick.network_services.traffic_profile.traffic_profile \
import TrexProfile
diff --git a/yardstick/network_services/traffic_profile/traffic_profile.py b/yardstick/network_services/traffic_profile/traffic_profile.py
index fcec04fed..7bbe89268 100644
--- a/yardstick/network_services/traffic_profile/traffic_profile.py
+++ b/yardstick/network_services/traffic_profile/traffic_profile.py
@@ -21,17 +21,17 @@ from random import SystemRandom
import six
from yardstick.network_services.traffic_profile.base import TrafficProfile
-from stl.trex_stl_lib.trex_stl_client import STLStream
-from stl.trex_stl_lib.trex_stl_streams import STLFlowLatencyStats
-from stl.trex_stl_lib.trex_stl_streams import STLTXCont
-from stl.trex_stl_lib.trex_stl_streams import STLProfile
-from stl.trex_stl_lib.trex_stl_packet_builder_scapy import STLVmWrFlowVar
-from stl.trex_stl_lib.trex_stl_packet_builder_scapy import STLVmFlowVarRepeatableRandom
-from stl.trex_stl_lib.trex_stl_packet_builder_scapy import STLVmFlowVar
-from stl.trex_stl_lib.trex_stl_packet_builder_scapy import STLPktBuilder
-from stl.trex_stl_lib.trex_stl_packet_builder_scapy import STLScVmRaw
-from stl.trex_stl_lib.trex_stl_packet_builder_scapy import STLVmFixIpv4
-from stl.trex_stl_lib import api as Pkt
+from trex_stl_lib.trex_stl_client import STLStream
+from trex_stl_lib.trex_stl_streams import STLFlowLatencyStats
+from trex_stl_lib.trex_stl_streams import STLTXCont
+from trex_stl_lib.trex_stl_streams import STLProfile
+from trex_stl_lib.trex_stl_packet_builder_scapy import STLVmWrFlowVar
+from trex_stl_lib.trex_stl_packet_builder_scapy import STLVmFlowVarRepeatableRandom
+from trex_stl_lib.trex_stl_packet_builder_scapy import STLVmFlowVar
+from trex_stl_lib.trex_stl_packet_builder_scapy import STLPktBuilder
+from trex_stl_lib.trex_stl_packet_builder_scapy import STLScVmRaw
+from trex_stl_lib.trex_stl_packet_builder_scapy import STLVmFixIpv4
+from trex_stl_lib import api as Pkt
class TrexProfile(TrafficProfile):
@@ -142,13 +142,12 @@ class TrexProfile(TrafficProfile):
src_ip4 = min_value
self._set_ip_fields(src=src_ip4)
else:
- stl_vm_flow_var = \
- STLVmFlowVarRepeatableRandom(name="ip4_src",
- min_value=min_value,
- max_value=max_value,
- size=4,
- limit=int(count),
- seed=0x1235)
+ stl_vm_flow_var = STLVmFlowVarRepeatableRandom(name="ip4_src",
+ min_value=min_value,
+ max_value=max_value,
+ size=4,
+ limit=int(count),
+ seed=0x1235)
self.vm_flow_vars.append(stl_vm_flow_var)
stl_vm_wr_flow_var = STLVmWrFlowVar(fv_name='ip4_src',
pkt_offset='IP.src')
@@ -165,13 +164,12 @@ class TrexProfile(TrafficProfile):
dst_ip4 = min_value
self._set_ip_fields(dst=dst_ip4)
else:
- stl_vm_flow_var = \
- STLVmFlowVarRepeatableRandom(name="dst_ip4",
- min_value=min_value,
- max_value=max_value,
- size=4,
- limit=int(count),
- seed=0x1235)
+ stl_vm_flow_var = STLVmFlowVarRepeatableRandom(name="dst_ip4",
+ min_value=min_value,
+ max_value=max_value,
+ size=4,
+ limit=int(count),
+ seed=0x1235)
self.vm_flow_vars.append(stl_vm_flow_var)
stl_vm_wr_flow_var = STLVmWrFlowVar(fv_name='dst_ip4',
pkt_offset='IP.dst')
@@ -253,13 +251,12 @@ class TrexProfile(TrafficProfile):
self._set_udp_fields(sport=src_port)
else:
max_value = int(src_ports[1])
- stl_vm_flow_var = \
- STLVmFlowVarRepeatableRandom(name="port_src",
- min_value=min_value,
- max_value=max_value,
- size=2,
- limit=int(count),
- seed=0x1235)
+ stl_vm_flow_var = STLVmFlowVarRepeatableRandom(name="port_src",
+ min_value=min_value,
+ max_value=max_value,
+ size=2,
+ limit=int(count),
+ seed=0x1235)
self.vm_flow_vars.append(stl_vm_flow_var)
stl_vm_wr_flow_var = STLVmWrFlowVar(fv_name='port_src',
pkt_offset=self.udp_sport)
diff --git a/yardstick/network_services/utils.py b/yardstick/network_services/utils.py
index 0264bbc1c..d52e27c15 100644
--- a/yardstick/network_services/utils.py
+++ b/yardstick/network_services/utils.py
@@ -30,7 +30,10 @@ OPTS = [
help='bin_path for VNFs location.'),
cfg.StrOpt('trex_path',
default=os.path.join(NSB_ROOT, 'trex/scripts'),
- help='trex automation lib pathh.'),
+ help='trex automation lib path.'),
+ cfg.StrOpt('trex_client_lib',
+ default=os.path.join(NSB_ROOT, 'trex_client/stl'),
+ help='trex python library path.'),
]
CONF.register_opts(OPTS, group="nsb")
diff --git a/yardstick/network_services/vnf_generic/vnf/sample_vnf.py b/yardstick/network_services/vnf_generic/vnf/sample_vnf.py
index 0434f6aef..7a756837e 100644
--- a/yardstick/network_services/vnf_generic/vnf/sample_vnf.py
+++ b/yardstick/network_services/vnf_generic/vnf/sample_vnf.py
@@ -37,9 +37,9 @@ from yardstick.network_services.vnf_generic.vnf.base import QueueFileWrapper
from yardstick.network_services.vnf_generic.vnf.base import GenericTrafficGen
from yardstick.network_services.utils import get_nsb_option
-from stl.trex_stl_lib.trex_stl_client import STLClient
-from stl.trex_stl_lib.trex_stl_client import LoggerApi
-from stl.trex_stl_lib.trex_stl_exceptions import STLError
+from trex_stl_lib.trex_stl_client import STLClient
+from trex_stl_lib.trex_stl_client import LoggerApi
+from trex_stl_lib.trex_stl_exceptions import STLError
from yardstick.ssh import AutoConnectSSH