aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRodolfo Alonso Hernandez <rodolfo.alonso.hernandez@intel.com>2018-05-23 09:16:39 +0100
committerRodolfo Alonso Hernandez <rodolfo.alonso.hernandez@intel.com>2018-06-18 13:50:27 +0100
commit1517319fd210d71db72c5e4bfa00fc49ae4fa877 (patch)
treefa7e0c6563b64ef4413be3c79912741f22712c5c
parent772d13797e7c84cbc0f8b7ac9005c97b8111cfa8 (diff)
Add "duration" parameter to test case definition
Add "duration" parameter to test case definition, in scenario:options section. This parameter will be rendered in the traffic profile. If the parameter is not present in the test case scenario options, the default time written in the traffic profile options will be 30 seconds (TrafficProfile.DEFAULT_DURATION = 30). If the traffic profile injection time is not defined, the default injection time will be 30 seconds. testcase:scenario:options:duration (default = 30) render --> traffic_profile:duration parse --> TrafficProfile.duration (default = 30) Target traffic profiles (RFC2544): - RFC2544Profile - IXIARFC2544Profile JIRA: YARDSTICK-1194 Change-Id: I968922e6bb882d7ee15aa1c4db4037face7a3492 Signed-off-by: Rodolfo Alonso Hernandez <rodolfo.alonso.hernandez@intel.com>
-rw-r--r--samples/vnf_samples/traffic_profiles/ipv4_throughput-10.yaml3
-rw-r--r--samples/vnf_samples/traffic_profiles/ipv4_throughput-2.yaml3
-rw-r--r--samples/vnf_samples/traffic_profiles/ipv4_throughput-3.yaml3
-rw-r--r--samples/vnf_samples/traffic_profiles/ipv4_throughput-4.yaml3
-rw-r--r--samples/vnf_samples/traffic_profiles/ipv4_throughput-cgnapt-ixia-scale-out.yaml3
-rw-r--r--samples/vnf_samples/traffic_profiles/ipv4_throughput-cgnapt-scale-out.yaml3
-rw-r--r--samples/vnf_samples/traffic_profiles/ipv4_throughput-ixia-correlated-scale-out.yaml3
-rw-r--r--samples/vnf_samples/traffic_profiles/ipv4_throughput-ixia-scale-out.yaml3
-rw-r--r--samples/vnf_samples/traffic_profiles/ipv4_throughput-scale-out.yaml3
-rw-r--r--samples/vnf_samples/traffic_profiles/ipv4_throughput-scale-up.yaml3
-rw-r--r--samples/vnf_samples/traffic_profiles/ipv4_throughput.yaml3
-rw-r--r--samples/vnf_samples/traffic_profiles/ipv4_throughput_cgnapt-10.yaml3
-rw-r--r--samples/vnf_samples/traffic_profiles/ipv4_throughput_cgnapt-2.yaml3
-rw-r--r--samples/vnf_samples/traffic_profiles/ipv4_throughput_cgnapt-4.yaml3
-rw-r--r--samples/vnf_samples/traffic_profiles/ipv4_throughput_cgnapt-scale-out.yaml3
-rw-r--r--samples/vnf_samples/traffic_profiles/ipv4_throughput_cgnapt.yaml3
-rw-r--r--samples/vnf_samples/traffic_profiles/ipv4_throughput_vpe.yaml3
-rw-r--r--samples/vnf_samples/traffic_profiles/ixia_ipv4_latency.yaml3
-rw-r--r--samples/vnf_samples/traffic_profiles/ixia_ipv4_latency_cgnapt.yaml3
-rw-r--r--samples/vnf_samples/traffic_profiles/ixia_ipv4_latency_vpe.yaml2
-rw-r--r--yardstick/benchmark/scenarios/networking/vnf_generic.py20
-rw-r--r--yardstick/network_services/traffic_profile/base.py22
-rw-r--r--yardstick/tests/unit/benchmark/scenarios/networking/test_vnf_generic.py3
-rw-r--r--yardstick/tests/unit/network_services/traffic_profile/test_base.py11
-rw-r--r--yardstick/tests/unit/network_services/traffic_profile/test_fixed.py3
-rw-r--r--yardstick/tests/unit/network_services/traffic_profile/test_http.py29
-rw-r--r--yardstick/tests/unit/network_services/traffic_profile/test_trex_traffic_profile.py111
27 files changed, 128 insertions, 130 deletions
diff --git a/samples/vnf_samples/traffic_profiles/ipv4_throughput-10.yaml b/samples/vnf_samples/traffic_profiles/ipv4_throughput-10.yaml
index f862abdb7..98b1bf96d 100644
--- a/samples/vnf_samples/traffic_profiles/ipv4_throughput-10.yaml
+++ b/samples/vnf_samples/traffic_profiles/ipv4_throughput-10.yaml
@@ -43,8 +43,7 @@ description: Traffic profile to run RFC2544 latency
traffic_profile:
traffic_type: RFC2544Profile # defines traffic behavior - constant or look for highest possible throughput
frame_rate: 100 # pc of linerate
- # that specifies a range (e.g. ipv4 address, port)
-
+ duration: {{ duration }}
uplink_0:
ipv4:
diff --git a/samples/vnf_samples/traffic_profiles/ipv4_throughput-2.yaml b/samples/vnf_samples/traffic_profiles/ipv4_throughput-2.yaml
index a3218879b..ee0415371 100644
--- a/samples/vnf_samples/traffic_profiles/ipv4_throughput-2.yaml
+++ b/samples/vnf_samples/traffic_profiles/ipv4_throughput-2.yaml
@@ -43,8 +43,7 @@ description: Traffic profile to run RFC2544 latency
traffic_profile:
traffic_type: RFC2544Profile # defines traffic behavior - constant or look for highest possible throughput
frame_rate: 100 # pc of linerate
- # that specifies a range (e.g. ipv4 address, port)
-
+ duration: {{ duration }}
uplink_0:
ipv4:
diff --git a/samples/vnf_samples/traffic_profiles/ipv4_throughput-3.yaml b/samples/vnf_samples/traffic_profiles/ipv4_throughput-3.yaml
index d849ed8ab..19f083646 100644
--- a/samples/vnf_samples/traffic_profiles/ipv4_throughput-3.yaml
+++ b/samples/vnf_samples/traffic_profiles/ipv4_throughput-3.yaml
@@ -43,8 +43,7 @@ description: Traffic profile to run RFC2544 latency
traffic_profile:
traffic_type: RFC2544Profile # defines traffic behavior - constant or look for highest possible throughput
frame_rate: 100 # pc of linerate
- # that specifies a range (e.g. ipv4 address, port)
-
+ duration: {{ duration }}
uplink_0:
ipv4:
diff --git a/samples/vnf_samples/traffic_profiles/ipv4_throughput-4.yaml b/samples/vnf_samples/traffic_profiles/ipv4_throughput-4.yaml
index c03b28d60..95fa0b6d8 100644
--- a/samples/vnf_samples/traffic_profiles/ipv4_throughput-4.yaml
+++ b/samples/vnf_samples/traffic_profiles/ipv4_throughput-4.yaml
@@ -43,8 +43,7 @@ description: Traffic profile to run RFC2544 latency
traffic_profile:
traffic_type: RFC2544Profile # defines traffic behavior - constant or look for highest possible throughput
frame_rate: 100 # pc of linerate
- # that specifies a range (e.g. ipv4 address, port)
-
+ duration: {{ duration }}
uplink_0:
ipv4:
diff --git a/samples/vnf_samples/traffic_profiles/ipv4_throughput-cgnapt-ixia-scale-out.yaml b/samples/vnf_samples/traffic_profiles/ipv4_throughput-cgnapt-ixia-scale-out.yaml
index ad703f291..43f52094a 100644
--- a/samples/vnf_samples/traffic_profiles/ipv4_throughput-cgnapt-ixia-scale-out.yaml
+++ b/samples/vnf_samples/traffic_profiles/ipv4_throughput-cgnapt-ixia-scale-out.yaml
@@ -44,8 +44,7 @@ description: Traffic profile to run RFC2544 latency
traffic_profile:
traffic_type: IXIARFC2544Profile # defines traffic behavior - constant or look for highest possible throughput
frame_rate: 100 # pc of linerate
- # that specifies a range (e.g. ipv4 address, port)
-
+ duration: {{ duration }}
[% for vnf_num in range(num_vnfs|int) %]
uplink_[[ vnf_num ]]:
diff --git a/samples/vnf_samples/traffic_profiles/ipv4_throughput-cgnapt-scale-out.yaml b/samples/vnf_samples/traffic_profiles/ipv4_throughput-cgnapt-scale-out.yaml
index 75927d40d..a025a6931 100644
--- a/samples/vnf_samples/traffic_profiles/ipv4_throughput-cgnapt-scale-out.yaml
+++ b/samples/vnf_samples/traffic_profiles/ipv4_throughput-cgnapt-scale-out.yaml
@@ -44,8 +44,7 @@ description: Traffic profile to run RFC2544 latency
traffic_profile:
traffic_type: RFC2544Profile # defines traffic behavior - constant or look for highest possible throughput
frame_rate: 100 # pc of linerate
- # that specifies a range (e.g. ipv4 address, port)
-
+ duration: {{ duration }}
[% for vnf_num in range(num_vnfs|int) %]
uplink_[[ vnf_num ]]:
diff --git a/samples/vnf_samples/traffic_profiles/ipv4_throughput-ixia-correlated-scale-out.yaml b/samples/vnf_samples/traffic_profiles/ipv4_throughput-ixia-correlated-scale-out.yaml
index 500163205..081d630ac 100644
--- a/samples/vnf_samples/traffic_profiles/ipv4_throughput-ixia-correlated-scale-out.yaml
+++ b/samples/vnf_samples/traffic_profiles/ipv4_throughput-ixia-correlated-scale-out.yaml
@@ -44,8 +44,7 @@ description: Traffic profile to run RFC2544 latency
traffic_profile:
traffic_type: IXIARFC2544Profile # defines traffic behavior - constant or look for highest possible throughput
frame_rate: 100 # pc of linerate
- # that specifies a range (e.g. ipv4 address, port)
-
+ duration: {{ duration }}
[% for vnf_num in range(num_vnfs|int) %]
uplink_[[ vnf_num ]]:
diff --git a/samples/vnf_samples/traffic_profiles/ipv4_throughput-ixia-scale-out.yaml b/samples/vnf_samples/traffic_profiles/ipv4_throughput-ixia-scale-out.yaml
index 78e5f516a..d93bf1145 100644
--- a/samples/vnf_samples/traffic_profiles/ipv4_throughput-ixia-scale-out.yaml
+++ b/samples/vnf_samples/traffic_profiles/ipv4_throughput-ixia-scale-out.yaml
@@ -44,8 +44,7 @@ description: Traffic profile to run RFC2544 latency
traffic_profile:
traffic_type: IXIARFC2544Profile # defines traffic behavior - constant or look for highest possible throughput
frame_rate: 100 # pc of linerate
- # that specifies a range (e.g. ipv4 address, port)
-
+ duration: {{ duration }}
[% for vnf_num in range(num_vnfs|int) %]
uplink_[[ vnf_num ]]:
diff --git a/samples/vnf_samples/traffic_profiles/ipv4_throughput-scale-out.yaml b/samples/vnf_samples/traffic_profiles/ipv4_throughput-scale-out.yaml
index 73c41099f..0e842d48a 100644
--- a/samples/vnf_samples/traffic_profiles/ipv4_throughput-scale-out.yaml
+++ b/samples/vnf_samples/traffic_profiles/ipv4_throughput-scale-out.yaml
@@ -44,8 +44,7 @@ description: Traffic profile to run RFC2544 latency
traffic_profile:
traffic_type: RFC2544Profile # defines traffic behavior - constant or look for highest possible throughput
frame_rate: 100 # pc of linerate
- # that specifies a range (e.g. ipv4 address, port)
-
+ duration: {{ duration }}
[% for vnf_num in range(num_vnfs|int) %]
uplink_[[ vnf_num ]]:
diff --git a/samples/vnf_samples/traffic_profiles/ipv4_throughput-scale-up.yaml b/samples/vnf_samples/traffic_profiles/ipv4_throughput-scale-up.yaml
index d2cc18c15..b9e0c8cd1 100644
--- a/samples/vnf_samples/traffic_profiles/ipv4_throughput-scale-up.yaml
+++ b/samples/vnf_samples/traffic_profiles/ipv4_throughput-scale-up.yaml
@@ -44,7 +44,8 @@ description: Traffic profile to run RFC2544 latency
traffic_profile:
traffic_type: RFC2544Profile # defines traffic behavior - constant or look for highest possible throughput
frame_rate: 100 # pc of linerate
- # that specifies a range (e.g. ipv4 address, port)
+ duration: {{ duration }}
+
{% set count = 0 %}
{% for vport in range(vports|int) %}
uplink_{{vport}}:
diff --git a/samples/vnf_samples/traffic_profiles/ipv4_throughput.yaml b/samples/vnf_samples/traffic_profiles/ipv4_throughput.yaml
index 5b5b4473b..c267e7677 100644
--- a/samples/vnf_samples/traffic_profiles/ipv4_throughput.yaml
+++ b/samples/vnf_samples/traffic_profiles/ipv4_throughput.yaml
@@ -42,8 +42,7 @@ description: Traffic profile to run RFC2544 latency
traffic_profile:
traffic_type : RFC2544Profile # defines traffic behavior - constant or look for highest possible throughput
frame_rate : 100 # pc of linerate
- # that specifies a range (e.g. ipv4 address, port)
-
+ duration: {{ duration }}
uplink_0:
ipv4:
diff --git a/samples/vnf_samples/traffic_profiles/ipv4_throughput_cgnapt-10.yaml b/samples/vnf_samples/traffic_profiles/ipv4_throughput_cgnapt-10.yaml
index 80d0872d5..1ff47a5b8 100644
--- a/samples/vnf_samples/traffic_profiles/ipv4_throughput_cgnapt-10.yaml
+++ b/samples/vnf_samples/traffic_profiles/ipv4_throughput_cgnapt-10.yaml
@@ -43,8 +43,7 @@ description: Traffic profile to run RFC2544 latency
traffic_profile:
traffic_type: RFC2544Profile # defines traffic behavior - constant or look for highest possible throughput
frame_rate: 100 # pc of linerate
- # that specifies a range (e.g. ipv4 address, port)
-
+ duration: {{ duration }}
uplink_0:
ipv4:
diff --git a/samples/vnf_samples/traffic_profiles/ipv4_throughput_cgnapt-2.yaml b/samples/vnf_samples/traffic_profiles/ipv4_throughput_cgnapt-2.yaml
index d6c9164a0..2b3e6f3d1 100644
--- a/samples/vnf_samples/traffic_profiles/ipv4_throughput_cgnapt-2.yaml
+++ b/samples/vnf_samples/traffic_profiles/ipv4_throughput_cgnapt-2.yaml
@@ -43,8 +43,7 @@ description: Traffic profile to run RFC2544 latency
traffic_profile:
traffic_type: RFC2544Profile # defines traffic behavior - constant or look for highest possible throughput
frame_rate: 100 # pc of linerate
- # that specifies a range (e.g. ipv4 address, port)
-
+ duration: {{ duration }}
uplink_0:
ipv4:
diff --git a/samples/vnf_samples/traffic_profiles/ipv4_throughput_cgnapt-4.yaml b/samples/vnf_samples/traffic_profiles/ipv4_throughput_cgnapt-4.yaml
index 55610b048..7df0682ed 100644
--- a/samples/vnf_samples/traffic_profiles/ipv4_throughput_cgnapt-4.yaml
+++ b/samples/vnf_samples/traffic_profiles/ipv4_throughput_cgnapt-4.yaml
@@ -43,8 +43,7 @@ description: Traffic profile to run RFC2544 latency
traffic_profile:
traffic_type: RFC2544Profile # defines traffic behavior - constant or look for highest possible throughput
frame_rate: 100 # pc of linerate
- # that specifies a range (e.g. ipv4 address, port)
-
+ duration: {{ duration }}
uplink_0:
ipv4:
diff --git a/samples/vnf_samples/traffic_profiles/ipv4_throughput_cgnapt-scale-out.yaml b/samples/vnf_samples/traffic_profiles/ipv4_throughput_cgnapt-scale-out.yaml
index d455bccea..82c487e1b 100644
--- a/samples/vnf_samples/traffic_profiles/ipv4_throughput_cgnapt-scale-out.yaml
+++ b/samples/vnf_samples/traffic_profiles/ipv4_throughput_cgnapt-scale-out.yaml
@@ -44,8 +44,7 @@ description: Traffic profile to run RFC2544 latency
traffic_profile:
traffic_type: RFC2544Profile # defines traffic behavior - constant or look for highest possible throughput
frame_rate: 100 # pc of linerate
- # that specifies a range (e.g. ipv4 address, port)
-
+ duration: {{ duration }}
[% for vnf_num in range(num_vnfs|int) %]
uplink_[[ vnf_num ]]:
diff --git a/samples/vnf_samples/traffic_profiles/ipv4_throughput_cgnapt.yaml b/samples/vnf_samples/traffic_profiles/ipv4_throughput_cgnapt.yaml
index 61cbd4e4e..809415a00 100644
--- a/samples/vnf_samples/traffic_profiles/ipv4_throughput_cgnapt.yaml
+++ b/samples/vnf_samples/traffic_profiles/ipv4_throughput_cgnapt.yaml
@@ -42,8 +42,7 @@ description: Traffic profile to run RFC2544 latency
traffic_profile:
traffic_type : RFC2544Profile # defines traffic behavior - constant or look for highest possible throughput
frame_rate : 100 # pc of linerate
- # that specifies a range (e.g. ipv4 address, port)
-
+ duration: {{ duration }}
uplink_0:
ipv4:
diff --git a/samples/vnf_samples/traffic_profiles/ipv4_throughput_vpe.yaml b/samples/vnf_samples/traffic_profiles/ipv4_throughput_vpe.yaml
index 20bc6568d..e113c9de2 100644
--- a/samples/vnf_samples/traffic_profiles/ipv4_throughput_vpe.yaml
+++ b/samples/vnf_samples/traffic_profiles/ipv4_throughput_vpe.yaml
@@ -42,8 +42,7 @@ description: Traffic profile to run RFC2544 latency
traffic_profile:
traffic_type : RFC2544Profile # defines traffic behavior - constant or look for highest possible throughput
frame_rate : 100 # pc of linerate
- # that specifies a range (e.g. ipv4 address, port)
-
+ duration: {{ duration }}
uplink_0:
ipv4:
diff --git a/samples/vnf_samples/traffic_profiles/ixia_ipv4_latency.yaml b/samples/vnf_samples/traffic_profiles/ixia_ipv4_latency.yaml
index 7b66d663b..b34672907 100644
--- a/samples/vnf_samples/traffic_profiles/ixia_ipv4_latency.yaml
+++ b/samples/vnf_samples/traffic_profiles/ixia_ipv4_latency.yaml
@@ -28,8 +28,7 @@ description: Traffic profile to run RFC2544 latency
traffic_profile:
traffic_type : IXIARFC2544Profile # defines traffic behavior - constant or look for highest possible throughput
frame_rate : 100 # pc of linerate
- # that specifies a range (e.g. ipv4 address, port)
-
+ duration: {{ duration }}
uplink_0:
ipv4:
diff --git a/samples/vnf_samples/traffic_profiles/ixia_ipv4_latency_cgnapt.yaml b/samples/vnf_samples/traffic_profiles/ixia_ipv4_latency_cgnapt.yaml
index 8fdfe9b2f..513aefb40 100644
--- a/samples/vnf_samples/traffic_profiles/ixia_ipv4_latency_cgnapt.yaml
+++ b/samples/vnf_samples/traffic_profiles/ixia_ipv4_latency_cgnapt.yaml
@@ -28,8 +28,7 @@ description: Traffic profile to run RFC2544 latency
traffic_profile:
traffic_type : IXIARFC2544Profile # defines traffic behavior - constant or look for highest possible throughput
frame_rate : 100 # pc of linerate
- # that specifies a range (e.g. ipv4 address, port)
-
+ duration: {{ duration }}
uplink_0:
ipv4:
diff --git a/samples/vnf_samples/traffic_profiles/ixia_ipv4_latency_vpe.yaml b/samples/vnf_samples/traffic_profiles/ixia_ipv4_latency_vpe.yaml
index 4d73b8ffe..aad751549 100644
--- a/samples/vnf_samples/traffic_profiles/ixia_ipv4_latency_vpe.yaml
+++ b/samples/vnf_samples/traffic_profiles/ixia_ipv4_latency_vpe.yaml
@@ -42,7 +42,7 @@ description: Traffic profile to run RFC2544 latency
traffic_profile:
traffic_type : IXIARFC2544Profile # defines traffic behavior - constant or look for highest possible throughput
frame_rate : 100 # pc of linerate
- # that specifies a range (e.g. ipv4 address, port)
+ injection_time: {{ injection_time }}
uplink_0:
ipv4:
diff --git a/yardstick/benchmark/scenarios/networking/vnf_generic.py b/yardstick/benchmark/scenarios/networking/vnf_generic.py
index 1c3ea1f8d..4f7ef60d5 100644
--- a/yardstick/benchmark/scenarios/networking/vnf_generic.py
+++ b/yardstick/benchmark/scenarios/networking/vnf_generic.py
@@ -133,11 +133,10 @@ class NetworkServiceTestCase(scenario_base.Scenario):
with utils.open_relative_file(profile, path) as infile:
return infile.read()
- def _get_topology(self):
- topology = self.scenario_cfg["topology"]
- path = self.scenario_cfg["task_path"]
- with utils.open_relative_file(topology, path) as infile:
- return infile.read()
+ def _get_duration(self):
+ options = self.scenario_cfg.get('options', {})
+ return options.get('duration',
+ tprofile_base.TrafficProfile.DEFAULT_DURATION)
def _fill_traffic_profile(self):
tprofile = self._get_traffic_profile()
@@ -147,12 +146,17 @@ class NetworkServiceTestCase(scenario_base.Scenario):
'imix': self._get_traffic_imix(),
tprofile_base.TrafficProfile.UPLINK: {},
tprofile_base.TrafficProfile.DOWNLINK: {},
- 'extra_args': extra_args
- }
-
+ 'extra_args': extra_args,
+ 'duration': self._get_duration()}
traffic_vnfd = vnfdgen.generate_vnfd(tprofile, tprofile_data)
self.traffic_profile = tprofile_base.TrafficProfile.get(traffic_vnfd)
+ def _get_topology(self):
+ topology = self.scenario_cfg["topology"]
+ path = self.scenario_cfg["task_path"]
+ with utils.open_relative_file(topology, path) as infile:
+ return infile.read()
+
def _render_topology(self):
topology = self._get_topology()
topology_args = self.scenario_cfg.get('extra_args', {})
diff --git a/yardstick/network_services/traffic_profile/base.py b/yardstick/network_services/traffic_profile/base.py
index 9eba550aa..4c3b29754 100644
--- a/yardstick/network_services/traffic_profile/base.py
+++ b/yardstick/network_services/traffic_profile/base.py
@@ -16,6 +16,26 @@ from yardstick.common import exceptions
from yardstick.common import utils
+class TrafficProfileConfig(object):
+ """Class to contain the TrafficProfile class information
+
+ This object will parse and validate the traffic profile information.
+ """
+ def __init__(self, tp_config):
+ self.schema = tp_config.get('schema', 'nsb:traffic_profile:0.1')
+ self.name = tp_config.get('name')
+ self.description = tp_config.get('description')
+ tprofile = tp_config['traffic_profile']
+ self.traffic_type = tprofile.get('traffic_type')
+ self.frame_rate = tprofile.get('frame_rate')
+ self.test_precision = tprofile.get('test_precision')
+ self.packet_sizes = tprofile.get('packet_sizes')
+ self.duration = tprofile.get('duration')
+ self.lower_bound = tprofile.get('lower_bound')
+ self.upper_bound = tprofile.get('upper_bound')
+ self.step_interval = tprofile.get('step_interval')
+
+
class TrafficProfile(object):
"""
This class defines the behavior
@@ -23,6 +43,7 @@ class TrafficProfile(object):
"""
UPLINK = "uplink"
DOWNLINK = "downlink"
+ DEFAULT_DURATION = 30
@staticmethod
def get(tp_config):
@@ -43,6 +64,7 @@ class TrafficProfile(object):
# e.g. RFC2544 start_ip, stop_ip, drop_rate,
# IMIX = {"10K": 0.1, "100M": 0.5}
self.params = tp_config
+ self.config = TrafficProfileConfig(tp_config)
def execute_traffic(self, traffic_generator, **kawrgs):
""" This methods defines the behavior of the traffic generator.
diff --git a/yardstick/tests/unit/benchmark/scenarios/networking/test_vnf_generic.py b/yardstick/tests/unit/benchmark/scenarios/networking/test_vnf_generic.py
index 2885dc6fb..bb1a7aaca 100644
--- a/yardstick/tests/unit/benchmark/scenarios/networking/test_vnf_generic.py
+++ b/yardstick/tests/unit/benchmark/scenarios/networking/test_vnf_generic.py
@@ -628,7 +628,8 @@ class TestNetworkServiceTestCase(unittest.TestCase):
'extra_args': {'arg1': 'value1', 'arg2': 'value2'},
'flow': {'flow': {}},
'imix': {'imix': {'64B': 100}},
- 'uplink': {}}
+ 'uplink': {},
+ 'duration': 30}
)
mock_tprofile_get.assert_called_once_with(fake_vnfd)
diff --git a/yardstick/tests/unit/network_services/traffic_profile/test_base.py b/yardstick/tests/unit/network_services/traffic_profile/test_base.py
index 641064cbe..cf4888d82 100644
--- a/yardstick/tests/unit/network_services/traffic_profile/test_base.py
+++ b/yardstick/tests/unit/network_services/traffic_profile/test_base.py
@@ -69,5 +69,14 @@ class TestTrafficProfile(unittest.TestCase):
class TestDummyProfile(unittest.TestCase):
def test_execute(self):
- dummy_profile = base.DummyProfile(base.TrafficProfile)
+ tp_config = {'traffic_profile': {'duration': 15}}
+ dummy_profile = base.DummyProfile(tp_config)
self.assertIsNone(dummy_profile.execute({}))
+
+
+class TrafficProfileConfigTestCase(unittest.TestCase):
+
+ def test__init(self):
+ tp_config = {'traffic_profile': {'duration': 15}}
+ tp_config_obj = base.TrafficProfileConfig(tp_config)
+ self.assertEqual(15, tp_config_obj.duration)
diff --git a/yardstick/tests/unit/network_services/traffic_profile/test_fixed.py b/yardstick/tests/unit/network_services/traffic_profile/test_fixed.py
index 39905e6b1..2f6713760 100644
--- a/yardstick/tests/unit/network_services/traffic_profile/test_fixed.py
+++ b/yardstick/tests/unit/network_services/traffic_profile/test_fixed.py
@@ -102,8 +102,7 @@ class TestFixedProfile(unittest.TestCase):
'id': 'VpeApproxVnf', 'name': 'VPEVnfSsh'}]}}
def test___init__(self):
- fixed_profile = \
- FixedProfile(TrafficProfile)
+ fixed_profile = FixedProfile(self.TRAFFIC_PROFILE)
self.assertIsNotNone(fixed_profile)
def test_execute(self):
diff --git a/yardstick/tests/unit/network_services/traffic_profile/test_http.py b/yardstick/tests/unit/network_services/traffic_profile/test_http.py
index 0d1b916a7..d44fab2b5 100644
--- a/yardstick/tests/unit/network_services/traffic_profile/test_http.py
+++ b/yardstick/tests/unit/network_services/traffic_profile/test_http.py
@@ -11,30 +11,29 @@
# 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.
-#
import unittest
-from yardstick.network_services.traffic_profile.base import TrafficProfile
-from yardstick.network_services.traffic_profile.http import \
- TrafficProfileGenericHTTP
+from yardstick.network_services.traffic_profile import http
class TestTrafficProfileGenericHTTP(unittest.TestCase):
+
+ TP_CONFIG = {'traffic_profile': {'duration': 10}}
+
def test___init__(self):
- traffic_profile_generic_htt_p = \
- TrafficProfileGenericHTTP(TrafficProfile)
- self.assertIsNotNone(traffic_profile_generic_htt_p)
+ tp_generic_http = http.TrafficProfileGenericHTTP(
+ self.TP_CONFIG)
+ self.assertIsNotNone(tp_generic_http)
def test_execute(self):
- traffic_profile_generic_htt_p = \
- TrafficProfileGenericHTTP(TrafficProfile)
+ tp_generic_http = http.TrafficProfileGenericHTTP(
+ self.TP_CONFIG)
traffic_generator = {}
- self.assertIsNone(
- traffic_profile_generic_htt_p.execute(traffic_generator))
+ self.assertIsNone(tp_generic_http.execute(traffic_generator))
def test__send_http_request(self):
- traffic_profile_generic_htt_p = \
- TrafficProfileGenericHTTP(TrafficProfile)
- self.assertIsNone(traffic_profile_generic_htt_p._send_http_request(
- "10.1.1.1", "250", "/req"))
+ tp_generic_http = http.TrafficProfileGenericHTTP(
+ self.TP_CONFIG)
+ self.assertIsNone(tp_generic_http._send_http_request(
+ '10.1.1.1', '250', '/req'))
diff --git a/yardstick/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 7111c8075..34face774 100644
--- a/yardstick/tests/unit/network_services/traffic_profile/test_trex_traffic_profile.py
+++ b/yardstick/tests/unit/network_services/traffic_profile/test_trex_traffic_profile.py
@@ -139,80 +139,63 @@ class TestTrexProfile(unittest.TestCase):
'count': 1}}},
'schema': 'isb:traffic_profile:0.1'}
+ def setUp(self):
+ self.trex_profile = TrexProfile(self.PROFILE)
+
def test___init__(self):
- TrafficProfile.params = self.PROFILE
- trex_profile = \
- TrexProfile(TrafficProfile)
- self.assertEqual(trex_profile.pps, 100)
+ self.assertEqual(self.trex_profile.pps, 100)
def test_qinq(self):
qinq = {"S-VLAN": {"id": 128, "priority": 0, "cfi": 0},
"C-VLAN": {"id": 512, "priority": 0, "cfi": 0}}
- trex_profile = \
- TrexProfile(TrafficProfile)
- self.assertIsNone(trex_profile.set_qinq(qinq))
+ self.assertIsNone(self.trex_profile.set_qinq(qinq))
qinq = {"S-VLAN": {"id": "128-130", "priority": 0, "cfi": 0},
"C-VLAN": {"id": "512-515", "priority": 0, "cfi": 0}}
- self.assertIsNone(trex_profile.set_qinq(qinq))
+ self.assertIsNone(self.trex_profile.set_qinq(qinq))
def test__set_outer_l2_fields(self):
- trex_profile = \
- TrexProfile(TrafficProfile)
qinq = {"S-VLAN": {"id": 128, "priority": 0, "cfi": 0},
"C-VLAN": {"id": 512, "priority": 0, "cfi": 0}}
outer_l2 = self.PROFILE[TrafficProfile.UPLINK]['ipv4']['outer_l2']
outer_l2['QinQ'] = qinq
- self.assertIsNone(trex_profile._set_outer_l2_fields(outer_l2))
+ self.assertIsNone(self.trex_profile._set_outer_l2_fields(outer_l2))
def test__set_outer_l3v4_fields(self):
- trex_profile = \
- TrexProfile(TrafficProfile)
outer_l3v4 = self.PROFILE[TrafficProfile.UPLINK]['ipv4']['outer_l3v4']
outer_l3v4['proto'] = 'tcp'
- self.assertIsNone(trex_profile._set_outer_l3v4_fields(outer_l3v4))
+ self.assertIsNone(self.trex_profile._set_outer_l3v4_fields(outer_l3v4))
def test__set_outer_l3v6_fields(self):
- trex_profile = \
- TrexProfile(TrafficProfile)
outer_l3v6 = self.PROFILE_v6[TrafficProfile.UPLINK]['ipv6']['outer_l3v4']
outer_l3v6['proto'] = 'tcp'
outer_l3v6['tc'] = 1
outer_l3v6['hlim'] = 10
- self.assertIsNone(trex_profile._set_outer_l3v6_fields(outer_l3v6))
+ self.assertIsNone(self.trex_profile._set_outer_l3v6_fields(outer_l3v6))
def test__set_outer_l4_fields(self):
- trex_profile = \
- TrexProfile(TrafficProfile)
outer_l4 = self.PROFILE[TrafficProfile.UPLINK]['ipv4']['outer_l4']
- self.assertIsNone(trex_profile._set_outer_l4_fields(outer_l4))
+ self.assertIsNone(self.trex_profile._set_outer_l4_fields(outer_l4))
def test_get_streams(self):
- trex_profile = \
- TrexProfile(TrafficProfile)
- trex_profile.params = self.PROFILE
profile_data = self.PROFILE[TrafficProfile.UPLINK]
- self.assertIsNotNone(trex_profile.get_streams(profile_data))
- trex_profile.pg_id = 1
- self.assertIsNotNone(trex_profile.get_streams(profile_data))
- trex_profile.params = self.PROFILE_v6
- trex_profile.profile_data = self.PROFILE_v6[TrafficProfile.UPLINK]
- self.assertIsNotNone(trex_profile.get_streams(profile_data))
- trex_profile.pg_id = 1
- self.assertIsNotNone(trex_profile.get_streams(profile_data))
+ self.assertIsNotNone(self.trex_profile.get_streams(profile_data))
+ self.trex_profile.pg_id = 1
+ self.assertIsNotNone(self.trex_profile.get_streams(profile_data))
+ self.trex_profile.params = self.PROFILE_v6
+ self.trex_profile.profile_data = self.PROFILE_v6[TrafficProfile.UPLINK]
+ self.assertIsNotNone(self.trex_profile.get_streams(profile_data))
+ self.trex_profile.pg_id = 1
+ self.assertIsNotNone(self.trex_profile.get_streams(profile_data))
def test_generate_packets(self):
- trex_profile = \
- TrexProfile(TrafficProfile)
- trex_profile.fsize = 10
- trex_profile.base_pkt = [10]
- self.assertIsNone(trex_profile.generate_packets())
+ self.trex_profile.fsize = 10
+ self.trex_profile.base_pkt = [10]
+ self.assertIsNone(self.trex_profile.generate_packets())
def test_generate_imix_data_error(self):
- trex_profile = \
- TrexProfile(TrafficProfile)
- self.assertEqual({}, trex_profile.generate_imix_data(False))
+ self.assertEqual({}, self.trex_profile.generate_imix_data(False))
def test__count_ip_ipv4(self):
start, end, count = TrexProfile._count_ip('1.1.1.1', '1.2.3.4')
@@ -237,7 +220,7 @@ class TestTrexProfile(unittest.TestCase):
TrexProfile._count_ip(start_ip, end_ip)
def test__dscp_range_action_partial_actual_count_zero(self):
- traffic_profile = TrexProfile(TrafficProfile)
+ traffic_profile = TrexProfile(self.PROFILE)
dscp_partial = traffic_profile._dscp_range_action_partial()
flow_vars_initial_length = len(traffic_profile.vm_flow_vars)
@@ -245,7 +228,7 @@ class TestTrexProfile(unittest.TestCase):
self.assertEqual(len(traffic_profile.vm_flow_vars), flow_vars_initial_length + 2)
def test__dscp_range_action_partial_count_greater_than_actual(self):
- traffic_profile = TrexProfile(TrafficProfile)
+ traffic_profile = TrexProfile(self.PROFILE)
dscp_partial = traffic_profile._dscp_range_action_partial()
flow_vars_initial_length = len(traffic_profile.vm_flow_vars)
@@ -253,7 +236,7 @@ class TestTrexProfile(unittest.TestCase):
self.assertEqual(len(traffic_profile.vm_flow_vars), flow_vars_initial_length + 2)
def test__udp_range_action_partial_actual_count_zero(self):
- traffic_profile = TrexProfile(TrafficProfile)
+ traffic_profile = TrexProfile(self.PROFILE)
traffic_profile.udp['field1'] = 'value1'
udp_partial = traffic_profile._udp_range_action_partial('field1')
@@ -262,7 +245,7 @@ class TestTrexProfile(unittest.TestCase):
self.assertEqual(len(traffic_profile.vm_flow_vars), flow_vars_initial_length + 2)
def test__udp_range_action_partial_count_greater_than_actual(self):
- traffic_profile = TrexProfile(TrafficProfile)
+ traffic_profile = TrexProfile(self.PROFILE)
traffic_profile.udp['field1'] = 'value1'
udp_partial = traffic_profile._udp_range_action_partial('field1', 'not_used_count')
@@ -271,39 +254,37 @@ class TestTrexProfile(unittest.TestCase):
self.assertEqual(len(traffic_profile.vm_flow_vars), flow_vars_initial_length + 2)
def test__general_single_action_partial(self):
- trex_profile = TrexProfile(TrafficProfile)
-
- trex_profile._general_single_action_partial(ETHERNET)(SRC)(
+ self.trex_profile._general_single_action_partial(ETHERNET)(SRC)(
self.EXAMPLE_ETHERNET_ADDR)
self.assertEqual(self.EXAMPLE_ETHERNET_ADDR,
- trex_profile.ether_packet.src)
+ self.trex_profile.ether_packet.src)
- trex_profile._general_single_action_partial(IP)(DST)(
+ self.trex_profile._general_single_action_partial(IP)(DST)(
self.EXAMPLE_IP_ADDR)
- self.assertEqual(self.EXAMPLE_IP_ADDR, trex_profile.ip_packet.dst)
+ self.assertEqual(self.EXAMPLE_IP_ADDR, self.trex_profile.ip_packet.dst)
- trex_profile._general_single_action_partial(IPv6)(DST)(
+ self.trex_profile._general_single_action_partial(IPv6)(DST)(
self.EXAMPLE_IPv6_ADDR)
- self.assertEqual(self.EXAMPLE_IPv6_ADDR, trex_profile.ip6_packet.dst)
+ self.assertEqual(self.EXAMPLE_IPv6_ADDR,
+ self.trex_profile.ip6_packet.dst)
- trex_profile._general_single_action_partial(UDP)(SRC_PORT)(5060)
- self.assertEqual(5060, trex_profile.udp_packet.sport)
+ self.trex_profile._general_single_action_partial(UDP)(SRC_PORT)(5060)
+ self.assertEqual(5060, self.trex_profile.udp_packet.sport)
- trex_profile._general_single_action_partial(IP)(TYPE_OF_SERVICE)(0)
- self.assertEqual(0, trex_profile.ip_packet.tos)
+ self.trex_profile._general_single_action_partial(
+ IP)(TYPE_OF_SERVICE)(0)
+ self.assertEqual(0, self.trex_profile.ip_packet.tos)
def test__set_proto_addr(self):
- trex_profile = TrexProfile(TrafficProfile)
-
ether_range = "00:00:00:00:00:01-00:00:00:00:00:02"
ip_range = "1.1.1.2-1.1.1.10"
ipv6_range = '0064:ff9b:0:0:0:0:9810:6414-0064:ff9b:0:0:0:0:9810:6420'
- trex_profile._set_proto_addr(ETHERNET, SRC, ether_range)
- trex_profile._set_proto_addr(ETHERNET, DST, ether_range)
- trex_profile._set_proto_addr(IP, SRC, ip_range)
- trex_profile._set_proto_addr(IP, DST, ip_range)
- trex_profile._set_proto_addr(IPv6, SRC, ipv6_range)
- trex_profile._set_proto_addr(IPv6, DST, ipv6_range)
- trex_profile._set_proto_addr(UDP, SRC_PORT, "5060-5090")
- trex_profile._set_proto_addr(UDP, DST_PORT, "5060")
+ self.trex_profile._set_proto_addr(ETHERNET, SRC, ether_range)
+ self.trex_profile._set_proto_addr(ETHERNET, DST, ether_range)
+ self.trex_profile._set_proto_addr(IP, SRC, ip_range)
+ self.trex_profile._set_proto_addr(IP, DST, ip_range)
+ self.trex_profile._set_proto_addr(IPv6, SRC, ipv6_range)
+ self.trex_profile._set_proto_addr(IPv6, DST, ipv6_range)
+ self.trex_profile._set_proto_addr(UDP, SRC_PORT, '5060-5090')
+ self.trex_profile._set_proto_addr(UDP, DST_PORT, '5060')