aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEmma Foley <emma.l.foley@intel.com>2018-06-22 16:39:35 +0000
committerGerrit Code Review <gerrit@opnfv.org>2018-06-22 16:39:35 +0000
commit3f3063363291b312f8c002086463a211338c1ae4 (patch)
tree50779656edc34c84a1d4e06914d7a950d49aa0f7
parentd5f86f8af56c19e0ce127522b72fbe3501e18b1d (diff)
parent84f634020d1a67f373127b831adc4ed0f6c438df (diff)
Merge "Move tests: unit/network_services/traffic_profile" into stable/fraser
-rw-r--r--yardstick/tests/unit/network_services/traffic_profile/__init__.py (renamed from tests/unit/network_services/traffic_profile/__init__.py)0
-rw-r--r--yardstick/tests/unit/network_services/traffic_profile/test_base.py (renamed from tests/unit/network_services/traffic_profile/test_base.py)0
-rw-r--r--yardstick/tests/unit/network_services/traffic_profile/test_fixed.py (renamed from tests/unit/network_services/traffic_profile/test_fixed.py)6
-rw-r--r--yardstick/tests/unit/network_services/traffic_profile/test_http.py (renamed from tests/unit/network_services/traffic_profile/test_http.py)3
-rw-r--r--yardstick/tests/unit/network_services/traffic_profile/test_http_ixload.py (renamed from tests/unit/network_services/traffic_profile/test_http_ixload.py)17
-rw-r--r--yardstick/tests/unit/network_services/traffic_profile/test_ixia_rfc2544.py (renamed from tests/unit/network_services/traffic_profile/test_ixia_rfc2544.py)122
-rw-r--r--yardstick/tests/unit/network_services/traffic_profile/test_prox_acl.py (renamed from tests/unit/network_services/traffic_profile/test_prox_acl.py)22
-rw-r--r--yardstick/tests/unit/network_services/traffic_profile/test_prox_binsearch.py (renamed from tests/unit/network_services/traffic_profile/test_prox_binsearch.py)4
-rw-r--r--yardstick/tests/unit/network_services/traffic_profile/test_prox_profile.py (renamed from tests/unit/network_services/traffic_profile/test_prox_profile.py)4
-rw-r--r--yardstick/tests/unit/network_services/traffic_profile/test_prox_ramp.py (renamed from tests/unit/network_services/traffic_profile/test_prox_ramp.py)4
-rw-r--r--yardstick/tests/unit/network_services/traffic_profile/test_rfc2544.py (renamed from tests/unit/network_services/traffic_profile/test_rfc2544.py)5
-rw-r--r--yardstick/tests/unit/network_services/traffic_profile/test_trex_traffic_profile.py (renamed from tests/unit/network_services/traffic_profile/test_trex_traffic_profile.py)2
12 files changed, 95 insertions, 94 deletions
diff --git a/tests/unit/network_services/traffic_profile/__init__.py b/yardstick/tests/unit/network_services/traffic_profile/__init__.py
index e69de29bb..e69de29bb 100644
--- a/tests/unit/network_services/traffic_profile/__init__.py
+++ b/yardstick/tests/unit/network_services/traffic_profile/__init__.py
diff --git a/tests/unit/network_services/traffic_profile/test_base.py b/yardstick/tests/unit/network_services/traffic_profile/test_base.py
index 3b8804976..3b8804976 100644
--- a/tests/unit/network_services/traffic_profile/test_base.py
+++ b/yardstick/tests/unit/network_services/traffic_profile/test_base.py
diff --git a/tests/unit/network_services/traffic_profile/test_fixed.py b/yardstick/tests/unit/network_services/traffic_profile/test_fixed.py
index dec94964b..39905e6b1 100644
--- a/tests/unit/network_services/traffic_profile/test_fixed.py
+++ b/yardstick/tests/unit/network_services/traffic_profile/test_fixed.py
@@ -13,12 +13,10 @@
# limitations under the License.
#
-from __future__ import absolute_import
-
-import unittest
import mock
+import unittest
-from tests.unit import STL_MOCKS
+from yardstick.tests 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_http.py b/yardstick/tests/unit/network_services/traffic_profile/test_http.py
index 5d8029ea0..0d1b916a7 100644
--- a/tests/unit/network_services/traffic_profile/test_http.py
+++ b/yardstick/tests/unit/network_services/traffic_profile/test_http.py
@@ -13,7 +13,6 @@
# limitations under the License.
#
-from __future__ import absolute_import
import unittest
from yardstick.network_services.traffic_profile.base import TrafficProfile
@@ -29,7 +28,7 @@ class TestTrafficProfileGenericHTTP(unittest.TestCase):
def test_execute(self):
traffic_profile_generic_htt_p = \
- TrafficProfileGenericHTTP(TrafficProfile)
+ TrafficProfileGenericHTTP(TrafficProfile)
traffic_generator = {}
self.assertIsNone(
traffic_profile_generic_htt_p.execute(traffic_generator))
diff --git a/tests/unit/network_services/traffic_profile/test_http_ixload.py b/yardstick/tests/unit/network_services/traffic_profile/test_http_ixload.py
index 5110439fd..57de6602d 100644
--- a/tests/unit/network_services/traffic_profile/test_http_ixload.py
+++ b/yardstick/tests/unit/network_services/traffic_profile/test_http_ixload.py
@@ -12,8 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-
-from __future__ import absolute_import
import unittest
import mock
@@ -187,9 +185,9 @@ class TestIxLoadTrafficGen(unittest.TestCase):
with self.assertRaises(Exception):
ixload.load_config_file("ixload.cfg")
- @mock.patch('yardstick.network_services.traffic_profile.http_ixload.IxLoad')
@mock.patch('yardstick.network_services.traffic_profile.http_ixload.StatCollectorUtils')
- def test_start_http_test_connect_error(self, mock_collector_type, mock_ixload_type):
+ @mock.patch('yardstick.network_services.traffic_profile.http_ixload.IxLoad')
+ def test_start_http_test_connect_error(self, mock_ixload_type, *args):
ports = [1, 2, 3]
test_input = {
"remote_server": "REMOTE_SERVER",
@@ -204,8 +202,7 @@ class TestIxLoadTrafficGen(unittest.TestCase):
j = jsonutils.dump_as_bytes(test_input)
- mock_ixload = mock_ixload_type()
- mock_ixload.connect.side_effect = RuntimeError
+ mock_ixload_type.return_value.connect.side_effect = RuntimeError
ixload = http_ixload.IXLOADHttpTest(j)
ixload.results_on_windows = 'windows_result_dir'
@@ -216,7 +213,7 @@ class TestIxLoadTrafficGen(unittest.TestCase):
@mock.patch('yardstick.network_services.traffic_profile.http_ixload.IxLoad')
@mock.patch('yardstick.network_services.traffic_profile.http_ixload.StatCollectorUtils')
- def test_start_http_test(self, mock_collector_type, mock_ixload_type):
+ def test_start_http_test(self, *args):
ports = [1, 2, 3]
test_input = {
"remote_server": "REMOTE_SERVER",
@@ -240,7 +237,7 @@ class TestIxLoadTrafficGen(unittest.TestCase):
@mock.patch('yardstick.network_services.traffic_profile.http_ixload.IxLoad')
@mock.patch('yardstick.network_services.traffic_profile.http_ixload.StatCollectorUtils')
- def test_start_http_test_reassign_error(self, mock_collector_type, mock_ixload_type):
+ def test_start_http_test_reassign_error(self, *args):
ports = [1, 2, 3]
test_input = {
"remote_server": "REMOTE_SERVER",
@@ -264,9 +261,9 @@ class TestIxLoadTrafficGen(unittest.TestCase):
ixload.result_dir = 'my_result_dir'
ixload.start_http_test()
- self.assertEqual(reassign_ports.call_count, 1)
+ reassign_ports.assert_called_once()
@mock.patch("yardstick.network_services.traffic_profile.http_ixload.IXLOADHttpTest")
- def test_main(self, IXLOADHttpTest):
+ def test_main(self, *args):
args = ["1", "2", "3"]
http_ixload.main(args)
diff --git a/tests/unit/network_services/traffic_profile/test_ixia_rfc2544.py b/yardstick/tests/unit/network_services/traffic_profile/test_ixia_rfc2544.py
index e8910d62b..a0abe2bbd 100644
--- a/tests/unit/network_services/traffic_profile/test_ixia_rfc2544.py
+++ b/yardstick/tests/unit/network_services/traffic_profile/test_ixia_rfc2544.py
@@ -13,14 +13,12 @@
# limitations under the License.
#
-from __future__ import absolute_import
-from __future__ import division
import unittest
import mock
from copy import deepcopy
-from tests.unit import STL_MOCKS
+from yardstick.tests import STL_MOCKS
STLClient = mock.MagicMock()
stl_patch = mock.patch.dict("sys.modules", STL_MOCKS)
@@ -48,35 +46,55 @@ class TestIXIARFC2544Profile(unittest.TestCase):
},
}
- PROFILE = {'description': 'Traffic profile to run RFC2544 latency',
- 'name': 'rfc2544',
- 'traffic_profile': {'traffic_type': 'IXIARFC2544Profile',
- 'frame_rate': 100},
- IXIARFC2544Profile.DOWNLINK: {'ipv4':
- {'outer_l2': {'framesize':
- {'64B': '100', '1518B': '0',
- '128B': '0', '1400B': '0',
- '256B': '0', '373b': '0',
- '570B': '0'}},
- 'outer_l3v4': {'dstip4': '1.1.1.1-1.15.255.255',
- 'proto': 'udp', 'count': '1',
- 'srcip4': '90.90.1.1-90.105.255.255',
- 'dscp': 0, 'ttl': 32},
- 'outer_l4': {'srcport': '2001',
- 'dsrport': '1234'}}},
- IXIARFC2544Profile.UPLINK: {'ipv4':
- {'outer_l2': {'framesize':
- {'64B': '100', '1518B': '0',
- '128B': '0', '1400B': '0',
- '256B': '0', '373b': '0',
- '570B': '0'}},
- 'outer_l3v4': {'dstip4': '9.9.1.1-90.105.255.255',
- 'proto': 'udp', 'count': '1',
- 'srcip4': '1.1.1.1-1.15.255.255',
- 'dscp': 0, 'ttl': 32},
- 'outer_l4': {'dstport': '2001',
- 'srcport': '1234'}}},
- 'schema': 'isb:traffic_profile:0.1'}
+ PROFILE = {
+ 'description': 'Traffic profile to run RFC2544 latency',
+ 'name': 'rfc2544',
+ 'traffic_profile': {
+ 'traffic_type': 'IXIARFC2544Profile',
+ 'frame_rate': 100},
+ IXIARFC2544Profile.DOWNLINK: {
+ 'ipv4': {
+ 'outer_l2': {
+ 'framesize': {
+ '64B': '100',
+ '1518B': '0',
+ '128B': '0',
+ '1400B': '0',
+ '256B': '0',
+ '373b': '0',
+ '570B': '0'}},
+ 'outer_l3v4': {
+ 'dstip4': '1.1.1.1-1.15.255.255',
+ 'proto': 'udp',
+ 'count': '1',
+ 'srcip4': '90.90.1.1-90.105.255.255',
+ 'dscp': 0,
+ 'ttl': 32},
+ 'outer_l4': {
+ 'srcport': '2001',
+ 'dsrport': '1234'}}},
+ IXIARFC2544Profile.UPLINK: {
+ 'ipv4': {
+ 'outer_l2': {
+ 'framesize': {
+ '64B': '100',
+ '1518B': '0',
+ '128B': '0',
+ '1400B': '0',
+ '256B': '0',
+ '373b': '0',
+ '570B': '0'}},
+ 'outer_l3v4': {
+ 'dstip4': '9.9.1.1-90.105.255.255',
+ 'proto': 'udp',
+ 'count': '1',
+ 'srcip4': '1.1.1.1-1.15.255.255',
+ 'dscp': 0,
+ 'ttl': 32},
+ 'outer_l4': {
+ 'dstport': '2001',
+ 'srcport': '1234'}}},
+ 'schema': 'isb:traffic_profile:0.1'}
def test_get_ixia_traffic_profile_error(self):
traffic_generator = mock.Mock(autospec=TrexProfile)
@@ -215,7 +233,6 @@ class TestIXIARFC2544Profile(unittest.TestCase):
"count": "1"
},
"outer_l3v6": {
- "count": 1024,
"dscp": 0,
"dstip4": "152.16.100.20",
"proto": "udp",
@@ -249,7 +266,6 @@ class TestIXIARFC2544Profile(unittest.TestCase):
"ttl": 32
},
"outer_l3v4": {
- "count": 1024,
"dscp": 0,
"dstip4": "152.16.100.20",
"proto": "udp",
@@ -257,7 +273,6 @@ class TestIXIARFC2544Profile(unittest.TestCase):
"ttl": 32,
},
"outer_l3v6": {
- "count": 1024,
"dscp": 0,
"dstip4": "152.16.100.20",
"proto": "udp",
@@ -408,24 +423,24 @@ class TestIXIARFC2544Profile(unittest.TestCase):
'outer_l4': {'srcport': '2001',
'dsrport': '1234'}}},
IXIARFC2544Profile.UPLINK: {'ipv4':
- {'outer_l2': {'framesize':
- {'64B': '100', '1518B': '0',
- '128B': '0', '1400B': '0',
- '256B': '0', '373b': '0',
- '570B': '0'}},
- 'outer_l3v4':
- {'dstip4': '9.9.1.1-90.105.255.255',
- 'proto': 'udp', 'count': '1',
- 'srcip4': '1.1.1.1-1.15.255.255',
- 'dscp': 0, 'ttl': 32},
- 'outer_l3v6':
- {'dstip6': '9.9.1.1-90.105.255.255',
- 'proto': 'udp', 'count': '1',
- 'srcip6': '1.1.1.1-1.15.255.255',
- 'dscp': 0, 'ttl': 32},
+ {'outer_l2': {'framesize':
+ {'64B': '100', '1518B': '0',
+ '128B': '0', '1400B': '0',
+ '256B': '0', '373b': '0',
+ '570B': '0'}},
+ 'outer_l3v4':
+ {'dstip4': '9.9.1.1-90.105.255.255',
+ 'proto': 'udp', 'count': '1',
+ 'srcip4': '1.1.1.1-1.15.255.255',
+ 'dscp': 0, 'ttl': 32},
+ 'outer_l3v6':
+ {'dstip6': '9.9.1.1-90.105.255.255',
+ 'proto': 'udp', 'count': '1',
+ 'srcip6': '1.1.1.1-1.15.255.255',
+ 'dscp': 0, 'ttl': 32},
- 'outer_l4': {'dstport': '2001',
- 'srcport': '1234'}}},
+ 'outer_l4': {'dstport': '2001',
+ 'srcport': '1234'}}},
'schema': 'isb:traffic_profile:0.1'}
result = r_f_c2544_profile._get_ixia_traffic_profile(profile_data, mac)
self.assertIsNotNone(result)
@@ -497,7 +512,8 @@ class TestIXIARFC2544Profile(unittest.TestCase):
r_f_c2544_profile.full_profile = {}
r_f_c2544_profile.get_streams = mock.Mock()
- self.assertIsNone(r_f_c2544_profile.update_traffic_profile(traffic_generator))
+ self.assertIsNone(
+ r_f_c2544_profile.update_traffic_profile(traffic_generator))
self.assertEqual(r_f_c2544_profile.ports, ports_expected)
def test_get_drop_percentage(self):
diff --git a/tests/unit/network_services/traffic_profile/test_prox_acl.py b/yardstick/tests/unit/network_services/traffic_profile/test_prox_acl.py
index ef5bac0d5..48c449b20 100644
--- a/tests/unit/network_services/traffic_profile/test_prox_acl.py
+++ b/yardstick/tests/unit/network_services/traffic_profile/test_prox_acl.py
@@ -13,12 +13,10 @@
# limitations under the License.
#
-from __future__ import absolute_import
-
import unittest
import mock
-from tests.unit import STL_MOCKS
+from yardstick.tests import STL_MOCKS
STLClient = mock.MagicMock()
stl_patch = mock.patch.dict("sys.modules", STL_MOCKS)
@@ -32,7 +30,7 @@ if stl_patch:
class TestProxACLProfile(unittest.TestCase):
def test_run_test_with_pkt_size(self):
- def target(*args, **kwargs):
+ def target(*args):
runs.append(args[2])
if args[2] < 0 or args[2] > 100:
raise RuntimeError(' '.join([str(args), str(runs)]))
@@ -40,13 +38,8 @@ class TestProxACLProfile(unittest.TestCase):
return fail_tuple, {}
return success_tuple, {}
- def get_mock_samples(*args, **kwargs):
- if args[2] < 0:
- raise RuntimeError(' '.join([str(args), str(runs)]))
- return success_tuple
-
tp_config = {
- 'traffic_profile': {
+ 'traffic_profile': {
'upper_bound': 100.0,
'lower_bound': 0.0,
'tolerated_loss': 50.0,
@@ -55,8 +48,10 @@ class TestProxACLProfile(unittest.TestCase):
}
runs = []
- success_tuple = ProxTestDataTuple(10.0, 1, 2, 3, 4, [5.1, 5.2, 5.3], 995, 1000, 123.4)
- fail_tuple = ProxTestDataTuple(10.0, 1, 2, 3, 4, [5.6, 5.7, 5.8], 850, 1000, 123.4)
+ success_tuple = ProxTestDataTuple(
+ 10.0, 1, 2, 3, 4, [5.1, 5.2, 5.3], 995, 1000, 123.4)
+ fail_tuple = ProxTestDataTuple(
+ 10.0, 1, 2, 3, 4, [5.6, 5.7, 5.8], 850, 1000, 123.4)
traffic_gen = mock.MagicMock()
@@ -75,4 +70,5 @@ class TestProxACLProfile(unittest.TestCase):
profile.tolerated_loss = 100.0
profile._profile_helper = profile_helper
- profile.run_test_with_pkt_size(traffic_gen, profile.pkt_size, profile.duration)
+ profile.run_test_with_pkt_size(
+ traffic_gen, profile.pkt_size, profile.duration)
diff --git a/tests/unit/network_services/traffic_profile/test_prox_binsearch.py b/yardstick/tests/unit/network_services/traffic_profile/test_prox_binsearch.py
index 1b4189b48..da550ade9 100644
--- a/tests/unit/network_services/traffic_profile/test_prox_binsearch.py
+++ b/yardstick/tests/unit/network_services/traffic_profile/test_prox_binsearch.py
@@ -13,12 +13,10 @@
# limitations under the License.
#
-from __future__ import absolute_import
-
import unittest
import mock
-from tests.unit import STL_MOCKS
+from yardstick.tests 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/yardstick/tests/unit/network_services/traffic_profile/test_prox_profile.py
index e5b36096f..e466305ea 100644
--- a/tests/unit/network_services/traffic_profile/test_prox_profile.py
+++ b/yardstick/tests/unit/network_services/traffic_profile/test_prox_profile.py
@@ -13,12 +13,10 @@
# limitations under the License.
#
-from __future__ import absolute_import
-
import unittest
import mock
-from tests.unit import STL_MOCKS
+from yardstick.tests 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/yardstick/tests/unit/network_services/traffic_profile/test_prox_ramp.py
index 1acec2f68..7a77e3295 100644
--- a/tests/unit/network_services/traffic_profile/test_prox_ramp.py
+++ b/yardstick/tests/unit/network_services/traffic_profile/test_prox_ramp.py
@@ -13,12 +13,10 @@
# limitations under the License.
#
-from __future__ import absolute_import
-
import unittest
import mock
-from tests.unit import STL_MOCKS
+from yardstick.tests 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/yardstick/tests/unit/network_services/traffic_profile/test_rfc2544.py
index cb3a547ee..2684e0ba1 100644
--- a/tests/unit/network_services/traffic_profile/test_rfc2544.py
+++ b/yardstick/tests/unit/network_services/traffic_profile/test_rfc2544.py
@@ -16,7 +16,7 @@
import unittest
import mock
-from tests.unit import STL_MOCKS
+from yardstick.tests import STL_MOCKS
STLClient = mock.MagicMock()
@@ -191,7 +191,8 @@ class TestRFC2544Profile(unittest.TestCase):
mock.Mock(return_value=True)
r_f_c2544_profile = RFC2544Profile(self.TRAFFIC_PROFILE)
r_f_c2544_profile.params = self.PROFILE
- self.assertIsNone(r_f_c2544_profile.execute_traffic(traffic_generator))
+ self.assertIsNone(
+ r_f_c2544_profile.execute_traffic(traffic_generator))
samples = {}
for ifname in range(1):
name = "xe{}".format(ifname)
diff --git a/tests/unit/network_services/traffic_profile/test_trex_traffic_profile.py b/yardstick/tests/unit/network_services/traffic_profile/test_trex_traffic_profile.py
index d1009a5e8..5fe1b7326 100644
--- a/tests/unit/network_services/traffic_profile/test_trex_traffic_profile.py
+++ b/yardstick/tests/unit/network_services/traffic_profile/test_trex_traffic_profile.py
@@ -18,7 +18,7 @@ import mock
import six
import unittest
-from tests.unit import STL_MOCKS
+from yardstick.tests import STL_MOCKS
from yardstick.common import exceptions as y_exc
STLClient = mock.MagicMock()