aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unit/network_services/traffic_profile
diff options
context:
space:
mode:
authorAbhijit Sinha <abhijit.sinha@intel.com>2017-09-12 19:08:41 +0100
committerRoss Brattain <ross.b.brattain@intel.com>2017-09-30 01:23:07 -0700
commit3cb73072d2da631f671ec54f3de518bb781a9623 (patch)
treea39d0a6e6f311691c6dbfd53481e81229cb724ea /tests/unit/network_services/traffic_profile
parent25eccae14eadc2cfe6ae6a3aff6087e0c324145d (diff)
Addition of Prox NSB BNG and BNG-QoS test
JIRA: YARDSTICK-802 Added Prox BNG and BNG-QoS Test - The tests supports BM, Openstack Heat - Supports 4 ports - Test added for BNG traffic profile - Fixed the Prox heat test cases with proper upstream and downstream links - Grafana Dashboard for BNG & BNG-QoS added - Increased the test Duration to 300 TODO: - Test does not Terminate correctly Update: Added new helper class for run_test: Genric, MPLS and BNG tests. Change-Id: Ib40811bedb45a3c3030643943f32679a4044e076 Signed-off-by: Abhijit Sinha <abhijit.sinha@intel.com> Signed-off-by: Edward MacGillivray <edward.s.macgillivray@intel.com> Signed-off-by: Ross Brattain <ross.b.brattain@intel.com> Signed-off-by: Daniel Martin Buckley <daniel.m.buckley@intel.com>
Diffstat (limited to 'tests/unit/network_services/traffic_profile')
-rw-r--r--tests/unit/network_services/traffic_profile/test_prox_acl.py16
-rw-r--r--tests/unit/network_services/traffic_profile/test_prox_binsearch.py10
-rw-r--r--tests/unit/network_services/traffic_profile/test_prox_mpls.py6
-rw-r--r--tests/unit/network_services/traffic_profile/test_prox_profile.py9
-rw-r--r--tests/unit/network_services/traffic_profile/test_prox_ramp.py21
5 files changed, 41 insertions, 21 deletions
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 a0c60186c..ef5bac0d5 100644
--- a/tests/unit/network_services/traffic_profile/test_prox_acl.py
+++ b/tests/unit/network_services/traffic_profile/test_prox_acl.py
@@ -59,18 +59,9 @@ class TestProxACLProfile(unittest.TestCase):
fail_tuple = ProxTestDataTuple(10.0, 1, 2, 3, 4, [5.6, 5.7, 5.8], 850, 1000, 123.4)
traffic_gen = mock.MagicMock()
- traffic_gen.run_test = target
-
- traffic_gen.resource_helper.run_test.side_effect = [
- success_tuple,
- success_tuple,
- success_tuple,
- fail_tuple,
- success_tuple,
- fail_tuple,
- fail_tuple,
- fail_tuple,
- ]
+
+ profile_helper = mock.MagicMock()
+ profile_helper.run_test = target
profile = ProxACLProfile(tp_config)
profile.init(mock.MagicMock())
@@ -82,5 +73,6 @@ class TestProxACLProfile(unittest.TestCase):
profile.duration = 30
profile.test_value = 100.0
profile.tolerated_loss = 100.0
+ profile._profile_helper = profile_helper
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/tests/unit/network_services/traffic_profile/test_prox_binsearch.py
index f56a7fba9..c1f1c825b 100644
--- a/tests/unit/network_services/traffic_profile/test_prox_binsearch.py
+++ b/tests/unit/network_services/traffic_profile/test_prox_binsearch.py
@@ -51,10 +51,13 @@ class TestProxBinSearchProfile(unittest.TestCase):
fail_tuple = ProxTestDataTuple(10.0, 1, 2, 3, 4, [5.6, 5.7, 5.8], 850, 1000, 123.4)
traffic_generator = mock.MagicMock()
- traffic_generator.run_test = target
+
+ profile_helper = mock.MagicMock()
+ profile_helper.run_test = target
profile = ProxBinSearchProfile(tp_config)
profile.init(mock.MagicMock())
+ profile._profile_helper = profile_helper
profile.execute_traffic(traffic_generator)
self.assertEqual(round(profile.current_lower, 2), 74.69)
@@ -82,10 +85,13 @@ class TestProxBinSearchProfile(unittest.TestCase):
fail_tuple = ProxTestDataTuple(10.0, 1, 2, 3, 4, [5.6, 5.7, 5.8], 850, 1000, 123.4)
traffic_generator = mock.MagicMock()
- traffic_generator.run_test = target
+
+ profile_helper = mock.MagicMock()
+ profile_helper.run_test = target
profile = ProxBinSearchProfile(tp_config)
profile.init(mock.MagicMock())
+ profile._profile_helper = profile_helper
profile.execute_traffic(traffic_generator)
self.assertEqual(round(profile.current_lower, 2), 24.06)
diff --git a/tests/unit/network_services/traffic_profile/test_prox_mpls.py b/tests/unit/network_services/traffic_profile/test_prox_mpls.py
index 642fecc35..00a690d2a 100644
--- a/tests/unit/network_services/traffic_profile/test_prox_mpls.py
+++ b/tests/unit/network_services/traffic_profile/test_prox_mpls.py
@@ -51,10 +51,11 @@ class TestProxMplsTagUntagProfile(unittest.TestCase):
fail_tuple = ProxTestDataTuple(10.0, 1, 2, 3, 4, [5.6, 5.7, 5.8], 850, 1000, 123.4)
traffic_generator = mock.MagicMock()
- traffic_generator.run_test = target
profile = ProxMplsTagUntagProfile(tp_config)
profile.init(mock.MagicMock())
+ profile._profile_helper = profile_helper = mock.MagicMock()
+ profile_helper.run_test = target
profile.execute_traffic(traffic_generator)
self.assertEqual(round(profile.current_lower, 2), 74.69)
@@ -82,10 +83,11 @@ class TestProxMplsTagUntagProfile(unittest.TestCase):
fail_tuple = ProxTestDataTuple(10.0, 1, 2, 3, 4, [5.6, 5.7, 5.8], 850, 1000, 123.4)
traffic_generator = mock.MagicMock()
- traffic_generator.run_test = target
profile = ProxMplsTagUntagProfile(tp_config)
profile.init(mock.MagicMock())
+ profile._profile_helper = profile_helper = mock.MagicMock()
+ profile_helper.run_test = target
profile.execute_traffic(traffic_generator)
self.assertEqual(round(profile.current_lower, 2), 24.06)
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 9899d9909..c32cc2878 100644
--- a/tests/unit/network_services/traffic_profile/test_prox_profile.py
+++ b/tests/unit/network_services/traffic_profile/test_prox_profile.py
@@ -26,6 +26,7 @@ stl_patch.start()
if stl_patch:
from yardstick.network_services.traffic_profile.prox_profile import ProxProfile
+ from yardstick.network_services.vnf_generic.vnf.prox_helpers import ProxResourceHelper
class TestProxProfile(unittest.TestCase):
@@ -78,6 +79,13 @@ class TestProxProfile(unittest.TestCase):
}
traffic_generator = mock.MagicMock()
+
+ setup_helper = traffic_generator.setup_helper
+ setup_helper.find_in_section.return_value = None
+
+ prox_resource_helper = ProxResourceHelper(setup_helper)
+ traffic_generator.resource_helper = prox_resource_helper
+
profile = ProxProfile(tp_config)
self.assertFalse(profile.done)
@@ -86,6 +94,7 @@ class TestProxProfile(unittest.TestCase):
profile.execute_traffic(traffic_generator)
self.assertIsNone(profile.execute_traffic(traffic_generator))
+ self.assertTrue(profile.done)
def test_bounds_iterator(self):
tp_config = {
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 357298759..1acec2f68 100644
--- a/tests/unit/network_services/traffic_profile/test_prox_ramp.py
+++ b/tests/unit/network_services/traffic_profile/test_prox_ramp.py
@@ -26,6 +26,7 @@ stl_patch.start()
if stl_patch:
from yardstick.network_services.traffic_profile.prox_ramp import ProxRampProfile
+ from yardstick.network_services.vnf_generic.vnf.prox_helpers import ProxProfileHelper
from yardstick.network_services.vnf_generic.vnf.prox_helpers import ProxTestDataTuple
@@ -43,14 +44,18 @@ class TestProxRampProfile(unittest.TestCase):
success_tuple = ProxTestDataTuple(10.0, 1, 2, 3, 4, [5.1, 5.2, 5.3], 995, 1000, 123.4)
traffic_gen = mock.MagicMock()
- traffic_gen.resource_helper.run_test.return_value = success_tuple
+ traffic_gen._test_type = 'Generic'
+
+ profile_helper = ProxProfileHelper(traffic_gen.resource_helper)
+ profile_helper.run_test = run_test = mock.MagicMock(return_value=success_tuple)
profile = ProxRampProfile(tp_config)
profile.fill_samples = fill_samples = mock.MagicMock()
profile.queue = mock.MagicMock()
+ profile._profile_helper = profile_helper
profile.run_test_with_pkt_size(traffic_gen, 128, 30)
- self.assertEqual(traffic_gen.resource_helper.run_test.call_count, 10)
+ self.assertEqual(run_test.call_count, 10)
self.assertEqual(fill_samples.call_count, 10)
def test_run_test_with_pkt_size_with_fail(self):
@@ -65,8 +70,7 @@ class TestProxRampProfile(unittest.TestCase):
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()
- traffic_gen.resource_helper.run_test.side_effect = [
+ result_list = [
success_tuple,
success_tuple,
success_tuple,
@@ -77,10 +81,17 @@ class TestProxRampProfile(unittest.TestCase):
fail_tuple,
]
+ traffic_gen = mock.MagicMock()
+ traffic_gen._test_type = 'Generic'
+
+ profile_helper = ProxProfileHelper(traffic_gen.resource_helper)
+ profile_helper.run_test = run_test = mock.MagicMock(side_effect=result_list)
+
profile = ProxRampProfile(tp_config)
profile.fill_samples = fill_samples = mock.MagicMock()
profile.queue = mock.MagicMock()
+ profile._profile_helper = profile_helper
profile.run_test_with_pkt_size(traffic_gen, 128, 30)
- self.assertEqual(traffic_gen.resource_helper.run_test.call_count, 4)
+ self.assertEqual(run_test.call_count, 4)
self.assertEqual(fill_samples.call_count, 3)