IXIA IxNetwork TP first rate is not populated 95/59495/2
authorRodolfo Alonso Hernandez <rodolfo.alonso.hernandez@intel.com>
Tue, 3 Jul 2018 14:47:42 +0000 (15:47 +0100)
committerRodolfo Alonso Hernandez <rodolfo.alonso.hernandez@intel.com>
Tue, 3 Jul 2018 16:32:28 +0000 (16:32 +0000)
IXIA IxNetwork traffic profile defines an initial injection frame rate
for RFC2544 test cases:
  schema: "isb:traffic_profile:0.1"
  traffic_profile:
    frame_rate : 20000

This value should be assigned to IXIARFC2544Profile.rate before the
initial injection period.

JIRA: YARDSTICK-1288

Change-Id: I29a334c7dbb863f680e45a1d3ab880aaf1fe166d
Signed-off-by: Rodolfo Alonso Hernandez <rodolfo.alonso.hernandez@intel.com>
yardstick/network_services/traffic_profile/ixia_rfc2544.py
yardstick/tests/unit/network_services/traffic_profile/test_ixia_rfc2544.py

index e105c2f..3933678 100644 (file)
@@ -25,6 +25,10 @@ class IXIARFC2544Profile(TrexProfile):
     UPLINK = 'uplink'
     DOWNLINK = 'downlink'
 
+    def __init__(self, yaml_data):
+        super(IXIARFC2544Profile, self).__init__(yaml_data)
+        self.rate = self.config.frame_rate
+
     def _get_ixia_traffic_profile(self, profile_data, mac=None):
         if mac is None:
             mac = {}
index 6b3532f..3bb8b91 100644 (file)
@@ -12,7 +12,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-from copy import deepcopy
+import copy
 
 import mock
 import unittest
@@ -440,6 +440,12 @@ class TestIXIARFC2544Profile(unittest.TestCase):
         result = r_f_c2544_profile._get_ixia_traffic_profile(profile_data, mac)
         self.assertIsNotNone(result)
 
+    def test__init__(self):
+        t_profile_data = copy.deepcopy(self.TRAFFIC_PROFILE)
+        t_profile_data['traffic_profile']['frame_rate'] = 12345678
+        r_f_c2544_profile = ixia_rfc2544.IXIARFC2544Profile(t_profile_data)
+        self.assertEqual(12345678, r_f_c2544_profile.rate)
+
     def test__get_ixia_traffic_profile_default_args(self):
         r_f_c2544_profile = ixia_rfc2544.IXIARFC2544Profile(
             self.TRAFFIC_PROFILE)
@@ -521,7 +527,7 @@ class TestIXIARFC2544Profile(unittest.TestCase):
         traffic_generator.vnfd_helper.port_num.side_effect = ports_expected
         traffic_generator.client.return_value = True
 
-        traffic_profile = deepcopy(self.TRAFFIC_PROFILE)
+        traffic_profile = copy.deepcopy(self.TRAFFIC_PROFILE)
         traffic_profile.update({
             "uplink_0": ["xe0"],
             "downlink_0": ["xe1", "xe2"],