aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/unit/network_services/libs/ixia_libs/test_IxNet.py13
-rw-r--r--yardstick/network_services/libs/ixia_libs/IxNet/IxNet.py13
-rw-r--r--yardstick/network_services/vnf_generic/vnf/sample_vnf.py1
-rw-r--r--yardstick/network_services/vnf_generic/vnf/tg_ixload.py1
-rw-r--r--yardstick/network_services/vnf_generic/vnf/tg_rfc2544_ixia.py5
5 files changed, 15 insertions, 18 deletions
diff --git a/tests/unit/network_services/libs/ixia_libs/test_IxNet.py b/tests/unit/network_services/libs/ixia_libs/test_IxNet.py
index 87d76f829..ae4c58de1 100644
--- a/tests/unit/network_services/libs/ixia_libs/test_IxNet.py
+++ b/tests/unit/network_services/libs/ixia_libs/test_IxNet.py
@@ -32,19 +32,14 @@ class TestIxNextgen(unittest.TestCase):
ixnet_gen = IxNextgen()
self.assertIsNone(ixnet_gen._bidir)
- @mock.patch("yardstick.network_services.libs.ixia_libs.IxNet.IxNet.IxNetwork")
@mock.patch("yardstick.network_services.libs.ixia_libs.IxNet.IxNet.sys")
- def test_connect(self, mock_sys, mock_ix_network):
- mock_ix_network.IxNet.return_value = mock_ixnet = mock.Mock()
+ def test_connect(self, mock_sys):
ixnet_gen = IxNextgen()
ixnet_gen.get_config = mock.MagicMock()
ixnet_gen.get_ixnet = mock.MagicMock()
- result = ixnet_gen._connect({"py_lib_path": "/tmp"})
- self.assertIsNotNone(result)
- self.assertEqual(mock_ix_network.IxNet.call_count, 1)
- self.assertEqual(mock_ixnet.connect.call_count, 1)
+ self.assertRaises(ImportError, ixnet_gen._connect, {"py_lib_path": "/tmp"})
def test_clear_ixia_config(self):
ixnet = mock.MagicMock()
@@ -455,7 +450,7 @@ class TestIxNextgen(unittest.TestCase):
}
ixnet = mock.MagicMock()
- ixnet.remapIds.return_value=["0"]
+ ixnet.remapIds.return_value = ["0"]
ixnet.setMultiAttribute.return_value = [1]
ixnet.commit.return_value = [1]
ixnet.getList.side_effect = [[1], [0, 1], [0], ["srcIp", "dstIp"]]
@@ -865,7 +860,7 @@ class TestIxNextgen(unittest.TestCase):
ixnet = mock.MagicMock()
ixnet.setMultiAttribute.return_value = [1]
ixnet.commit.return_value = [1]
- ixnet.getList.side_effect=[
+ ixnet.getList.side_effect = [
[1],
[1],
[1],
diff --git a/yardstick/network_services/libs/ixia_libs/IxNet/IxNet.py b/yardstick/network_services/libs/ixia_libs/IxNet/IxNet.py
index d36ec2edd..2b8905b4f 100644
--- a/yardstick/network_services/libs/ixia_libs/IxNet/IxNet.py
+++ b/yardstick/network_services/libs/ixia_libs/IxNet/IxNet.py
@@ -20,13 +20,6 @@ import logging
import re
from itertools import product
-from yardstick.common.utils import ErrorClass
-
-try:
- import IxNetwork
-except ImportError:
- IxNetwork = ErrorClass
-
log = logging.getLogger(__name__)
IP_VERSION_4 = 4
@@ -203,6 +196,12 @@ class IxNextgen(object):
self._cfg = self.get_config(tg_cfg)
sys.path.append(self._cfg["py_lib_path"])
+ # Import IxNetwork after getting ixia lib path
+ try:
+ import IxNetwork
+ except ImportError:
+ raise
+
self.ixnet = IxNetwork.IxNet()
machine = self._cfg['machine']
diff --git a/yardstick/network_services/vnf_generic/vnf/sample_vnf.py b/yardstick/network_services/vnf_generic/vnf/sample_vnf.py
index 659a7638c..0434f6aef 100644
--- a/yardstick/network_services/vnf_generic/vnf/sample_vnf.py
+++ b/yardstick/network_services/vnf_generic/vnf/sample_vnf.py
@@ -931,6 +931,7 @@ class SampleVNFTrafficGen(GenericTrafficGen):
self._tg_process.start()
def wait_for_instantiate(self):
+ # overridden by subclasses
return self._wait_for_process()
def _check_status(self):
diff --git a/yardstick/network_services/vnf_generic/vnf/tg_ixload.py b/yardstick/network_services/vnf_generic/vnf/tg_ixload.py
index c15f7b954..c50490020 100644
--- a/yardstick/network_services/vnf_generic/vnf/tg_ixload.py
+++ b/yardstick/network_services/vnf_generic/vnf/tg_ixload.py
@@ -122,7 +122,6 @@ class IxLoadTrafficGen(SampleVNFTrafficGen):
super(IxLoadTrafficGen, self).__init__(name, vnfd, setup_env_helper_type,
resource_helper_type)
self._result = {}
- self.done = False
self.data = None
def run_traffic(self, traffic_profile):
diff --git a/yardstick/network_services/vnf_generic/vnf/tg_rfc2544_ixia.py b/yardstick/network_services/vnf_generic/vnf/tg_rfc2544_ixia.py
index 3d3fe73ea..4abe06059 100644
--- a/yardstick/network_services/vnf_generic/vnf/tg_rfc2544_ixia.py
+++ b/yardstick/network_services/vnf_generic/vnf/tg_rfc2544_ixia.py
@@ -146,7 +146,6 @@ class IxiaTrafficGen(SampleVNFTrafficGen):
super(IxiaTrafficGen, self).__init__(name, vnfd, setup_env_helper_type,
resource_helper_type)
- self.done = True
self._ixia_traffic_gen = None
self.ixia_file_name = ''
self.tg_port_pairs = []
@@ -164,3 +163,7 @@ class IxiaTrafficGen(SampleVNFTrafficGen):
def terminate(self):
self.resource_helper.stop_collect()
super(IxiaTrafficGen, self).terminate()
+
+ def wait_for_instantiate(self):
+ # not needed for IxNet
+ pass