summaryrefslogtreecommitdiffstats
path: root/tests/unit/network_services/vnf_generic
diff options
context:
space:
mode:
authorDanielMartinBuckley <daniel.m.buckley@intel.com>2018-03-07 18:09:12 +0000
committerDanielMartinBuckley <daniel.m.buckley@intel.com>2018-03-09 14:04:03 +0000
commitf7e477133cfc87134bb860aaaf39d932bbae1907 (patch)
tree23e19f938b6a35f7225ac1e052f26220172c2178 /tests/unit/network_services/vnf_generic
parentf753fb86cc26e08dca168c0827d28a7b6f022d1f (diff)
Do NOT hardcode interface speed for PROX tests
JIRA: YARDSTICK-1035 Do not hardcode NIC/interface speed in PROX test. Test assumes NIC used is 10Gbps. This is incorrect. It could support 1Gbps, 10Gbps, 25Gbps, 40Gbps or something else. This is used to calculate pps (Packets Per Second) In Baremetal the NIC speed could be extracted. however when run on a virtual machine this is not possible. Solution: Add in options section of test file. eg. Options: interface_speed_gbps: 10 Where 10 refers to a 10Gbps. In a setup where multiple interfaces are used. This will refer to the speed of the slowest connection. Change-Id: I89ab16479a2cdd1d79e52cbcc5a972762c60d057 Signed-off-by: Daniel Martin Buckley <daniel.m.buckley@intel.com>
Diffstat (limited to 'tests/unit/network_services/vnf_generic')
-rw-r--r--tests/unit/network_services/vnf_generic/vnf/test_prox_helpers.py30
1 files changed, 19 insertions, 11 deletions
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 faceeb695..bc48f994c 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
@@ -24,7 +24,7 @@ import unittest
from tests.unit import STL_MOCKS
from yardstick.common import utils
from yardstick.network_services.vnf_generic.vnf.base import VnfdHelper
-
+from yardstick.network_services import constants
STLClient = mock.MagicMock()
stl_patch = mock.patch.dict("sys.modules", STL_MOCKS)
@@ -46,7 +46,6 @@ if stl_patch:
from yardstick.network_services.vnf_generic.vnf.prox_helpers import ProxVpeProfileHelper
from yardstick.network_services.vnf_generic.vnf.prox_helpers import ProxlwAFTRProfileHelper
-
class TestCoreTuple(unittest.TestCase):
def test___init__(self):
core_tuple = CoreSocketTuple('core 5s6')
@@ -1537,7 +1536,9 @@ class TestProxDataHelper(unittest.TestCase):
sut = mock.MagicMock()
sut.port_stats.return_value = list(range(10))
- data_helper = ProxDataHelper(vnfd_helper, sut, pkt_size, 25, None)
+ data_helper = ProxDataHelper(
+ vnfd_helper, sut, pkt_size, 25, None,
+ constants.NIC_GBPS_DEFAULT * constants.ONE_GIGABIT_IN_BITS)
self.assertEqual(data_helper.rx_total, 6)
self.assertEqual(data_helper.tx_total, 7)
@@ -1551,7 +1552,7 @@ class TestProxDataHelper(unittest.TestCase):
sut = mock.MagicMock()
sut.port_stats.return_value = list(range(10))
- data_helper = ProxDataHelper(vnfd_helper, sut, None, None, None)
+ data_helper = ProxDataHelper(vnfd_helper, sut, None, None, None, None)
expected = {
'xe1': {
@@ -1574,13 +1575,15 @@ class TestProxDataHelper(unittest.TestCase):
sut = mock.MagicMock()
sut.port_stats.return_value = list(range(10))
- data_helper = ProxDataHelper(vnfd_helper, sut, None, None, 5.4)
+ data_helper = ProxDataHelper(vnfd_helper, sut, None, None,
+ 5.4, constants.NIC_GBPS_DEFAULT * constants.ONE_GIGABIT_IN_BITS)
data_helper._totals_and_pps = 12, 32, 4.5
data_helper.tsc_hz = 9.8
data_helper.measured_stats = {'delta': TotStatsTuple(6.1, 6.2, 6.3, 6.4)}
data_helper.latency = 7
self.assertIsNone(data_helper.result_tuple)
+ self.assertEqual(data_helper.line_speed, 10000000000)
expected = ProxTestDataTuple(5.4, 9.8, 6.1, 6.2, 6.3, 7, 12, 32, 4.5)
with data_helper:
@@ -1595,7 +1598,7 @@ class TestProxDataHelper(unittest.TestCase):
def test___enter___negative(self):
vnfd_helper = mock.MagicMock()
- data_helper = ProxDataHelper(vnfd_helper, None, None, None, None)
+ data_helper = ProxDataHelper(vnfd_helper, None, None, None, None, None)
vnfd_helper.port_pairs.all_ports = []
with self.assertRaises(AssertionError):
@@ -1617,7 +1620,7 @@ class TestProxDataHelper(unittest.TestCase):
sut = ProxSocketHelper(mock.MagicMock())
sut.get_all_tot_stats = mock.MagicMock(side_effect=[start, end])
- data_helper = ProxDataHelper(vnfd_helper, sut, None, None, 5.4)
+ data_helper = ProxDataHelper(vnfd_helper, sut, None, None, 5.4, None)
self.assertIsNone(data_helper.measured_stats)
@@ -1638,7 +1641,7 @@ class TestProxDataHelper(unittest.TestCase):
sut = mock.MagicMock()
sut.hz.return_value = '54.6'
- data_helper = ProxDataHelper(vnfd_helper, sut, None, None, None)
+ data_helper = ProxDataHelper(vnfd_helper, sut, None, None, None, None)
self.assertIsNone(data_helper.tsc_hz)
@@ -1935,7 +1938,8 @@ class TestProxProfileHelper(unittest.TestCase):
helper = ProxProfileHelper(resource_helper)
- helper.run_test(120, 5, 6.5)
+ helper.run_test(120, 5, 6.5,
+ constants.NIC_GBPS_DEFAULT * constants.ONE_GIGABIT_IN_BITS)
class TestProxMplsProfileHelper(unittest.TestCase):
@@ -2081,8 +2085,12 @@ class TestProxBngProfileHelper(unittest.TestCase):
helper = ProxBngProfileHelper(resource_helper)
- helper.run_test(120, 5, 6.5)
- helper.run_test(-1000, 5, 6.5) # negative pkt_size is the only way to make ratio > 1
+ helper.run_test(120, 5, 6.5,
+ constants.NIC_GBPS_DEFAULT * constants.ONE_GIGABIT_IN_BITS)
+
+ # negative pkt_size is the only way to make ratio > 1
+ helper.run_test(-1000, 5, 6.5,
+ constants.NIC_GBPS_DEFAULT * constants.ONE_GIGABIT_IN_BITS)
class TestProxVpeProfileHelper(unittest.TestCase):