Add "duration" parameter to test case definition 61/58861/4
authorRodolfo Alonso Hernandez <rodolfo.alonso.hernandez@intel.com>
Wed, 23 May 2018 08:16:39 +0000 (09:16 +0100)
committerEmma Foley <emma.l.foley@intel.com>
Mon, 25 Jun 2018 14:07:02 +0000 (15:07 +0100)
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>
(cherry picked from commit 1517319fd210d71db72c5e4bfa00fc49ae4fa877)

27 files changed:
samples/vnf_samples/traffic_profiles/ipv4_throughput-10.yaml
samples/vnf_samples/traffic_profiles/ipv4_throughput-2.yaml
samples/vnf_samples/traffic_profiles/ipv4_throughput-3.yaml
samples/vnf_samples/traffic_profiles/ipv4_throughput-4.yaml
samples/vnf_samples/traffic_profiles/ipv4_throughput-cgnapt-ixia-scale-out.yaml
samples/vnf_samples/traffic_profiles/ipv4_throughput-cgnapt-scale-out.yaml
samples/vnf_samples/traffic_profiles/ipv4_throughput-ixia-correlated-scale-out.yaml
samples/vnf_samples/traffic_profiles/ipv4_throughput-ixia-scale-out.yaml
samples/vnf_samples/traffic_profiles/ipv4_throughput-scale-out.yaml
samples/vnf_samples/traffic_profiles/ipv4_throughput-scale-up.yaml
samples/vnf_samples/traffic_profiles/ipv4_throughput.yaml
samples/vnf_samples/traffic_profiles/ipv4_throughput_cgnapt-10.yaml
samples/vnf_samples/traffic_profiles/ipv4_throughput_cgnapt-2.yaml
samples/vnf_samples/traffic_profiles/ipv4_throughput_cgnapt-4.yaml
samples/vnf_samples/traffic_profiles/ipv4_throughput_cgnapt-scale-out.yaml
samples/vnf_samples/traffic_profiles/ipv4_throughput_cgnapt.yaml
samples/vnf_samples/traffic_profiles/ipv4_throughput_vpe.yaml
samples/vnf_samples/traffic_profiles/ixia_ipv4_latency.yaml
samples/vnf_samples/traffic_profiles/ixia_ipv4_latency_cgnapt.yaml
samples/vnf_samples/traffic_profiles/ixia_ipv4_latency_vpe.yaml
yardstick/benchmark/scenarios/networking/vnf_generic.py
yardstick/network_services/traffic_profile/base.py
yardstick/tests/unit/benchmark/scenarios/networking/test_vnf_generic.py
yardstick/tests/unit/network_services/traffic_profile/test_base.py
yardstick/tests/unit/network_services/traffic_profile/test_fixed.py
yardstick/tests/unit/network_services/traffic_profile/test_http.py
yardstick/tests/unit/network_services/traffic_profile/test_trex_traffic_profile.py

index f862abd..98b1bf9 100644 (file)
@@ -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:
index a321887..ee04153 100644 (file)
@@ -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:
index d849ed8..19f0836 100644 (file)
@@ -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:
index c03b28d..95fa0b6 100644 (file)
@@ -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:
index ad703f2..43f5209 100644 (file)
@@ -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 ]]:
index 75927d4..a025a69 100644 (file)
@@ -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 ]]:
index 5001632..081d630 100644 (file)
@@ -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 ]]:
index 78e5f51..d93bf11 100644 (file)
@@ -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 ]]:
index 73c4109..0e842d4 100644 (file)
@@ -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 ]]:
index d2cc18c..b9e0c8c 100644 (file)
@@ -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}}:
index 5b5b447..c267e76 100644 (file)
@@ -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:
index 80d0872..1ff47a5 100644 (file)
@@ -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:
index d6c9164..2b3e6f3 100644 (file)
@@ -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:
index 55610b0..7df0682 100644 (file)
@@ -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:
index d455bcc..82c487e 100644 (file)
@@ -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 ]]:
index 61cbd4e..809415a 100644 (file)
@@ -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:
index 20bc656..e113c9d 100644 (file)
@@ -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:
index 7b66d66..b346729 100644 (file)
@@ -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:
index 8fdfe9b..513aefb 100644 (file)
@@ -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:
index 4d73b8f..aad7515 100644 (file)
@@ -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:
index 1c3ea1f..4f7ef60 100644 (file)
@@ -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', {})
index 9eba550..4c3b297 100644 (file)
@@ -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.
index 2885dc6..bb1a7aa 100644 (file)
@@ -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)
 
index 641064c..cf4888d 100644 (file)
@@ -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)
index 39905e6..2f67137 100644 (file)
@@ -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):
index 0d1b916..d44fab2 100644 (file)
 # 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'))
index 5fe1b73..bc83224 100644 (file)
@@ -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')