aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMytnyk, Volodymyr <volodymyrx.mytnyk@intel.com>2018-08-16 08:40:04 +0100
committerMytnyk, Volodymyr <volodymyrx.mytnyk@intel.com>2018-08-16 10:26:02 +0100
commiteed1b9cca960e7c7a3980d0a94b3589cf6b81eab (patch)
tree40bccad2af6878f5e7dc3c557226361afab5d433
parentf32d9e5e452429905c8099db9b5d4a0fa14dff13 (diff)
Fix setting `flow` configuration in TC yaml
The `flow` configuration is not applied to the traffic profile if `seed` or `count` option is missing in the TC definition. - Fix `seed` backward compatibility. JIRA: YARDSTICK-1383 Change-Id: Ic874fb2be1c13009f94eb3a80194bfe81d7a923b Signed-off-by: Mytnyk, Volodymyr <volodymyrx.mytnyk@intel.com>
-rw-r--r--yardstick/benchmark/scenarios/networking/vnf_generic.py8
-rw-r--r--yardstick/network_services/traffic_profile/ixia_rfc2544.py4
-rw-r--r--yardstick/tests/unit/benchmark/scenarios/networking/test_vnf_generic.py10
3 files changed, 12 insertions, 10 deletions
diff --git a/yardstick/benchmark/scenarios/networking/vnf_generic.py b/yardstick/benchmark/scenarios/networking/vnf_generic.py
index 10f10d4e6..4884e57a8 100644
--- a/yardstick/benchmark/scenarios/networking/vnf_generic.py
+++ b/yardstick/benchmark/scenarios/networking/vnf_generic.py
@@ -117,8 +117,12 @@ class NetworkServiceTestCase(scenario_base.Scenario):
for index, dst_port in enumerate(fflow.get("dst_port", [])):
flow["dst_port_{}".format(index)] = dst_port
- flow["count"] = fflow["count"]
- flow["seed"] = fflow["seed"]
+ if "count" in fflow:
+ flow["count"] = fflow["count"]
+
+ if "seed" in fflow:
+ flow["seed"] = fflow["seed"]
+
except KeyError:
flow = {}
return {"flow": flow}
diff --git a/yardstick/network_services/traffic_profile/ixia_rfc2544.py b/yardstick/network_services/traffic_profile/ixia_rfc2544.py
index 26dc1fe04..ccaf3ded3 100644
--- a/yardstick/network_services/traffic_profile/ixia_rfc2544.py
+++ b/yardstick/network_services/traffic_profile/ixia_rfc2544.py
@@ -96,7 +96,7 @@ class IXIARFC2544Profile(trex_traffic_profile.TrexProfile):
'count': ip['count'],
'dscp': ip['dscp'],
'ttl': ip['ttl'],
- 'seed': ip['seed'],
+ 'seed': ip.get('seed', 1),
'srcip': srcip,
'dstip': dstip,
'srcmask': srcmask,
@@ -110,7 +110,7 @@ class IXIARFC2544Profile(trex_traffic_profile.TrexProfile):
'srcportmask': src_port_mask,
'dstportmask': dst_port_mask,
'count': outer_l4['count'],
- 'seed': outer_l4['seed'],
+ 'seed': outer_l4.get('seed', 1)
}
}
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 49578b383..6bf2f2c2f 100644
--- a/yardstick/tests/unit/benchmark/scenarios/networking/test_vnf_generic.py
+++ b/yardstick/tests/unit/benchmark/scenarios/networking/test_vnf_generic.py
@@ -405,7 +405,6 @@ class TestNetworkServiceTestCase(unittest.TestCase):
def test___get_traffic_flow(self):
self.scenario_cfg["traffic_options"]["flow"] = \
self._get_file_abspath("ipv4_1flow_Packets_vpe.yaml")
- self.scenario_cfg["options"] = {}
self.scenario_cfg['options'] = {
'flow': {
'src_ip': [
@@ -421,11 +420,10 @@ class TestNetworkServiceTestCase(unittest.TestCase):
'public_ip': ['1.1.1.1'],
},
}
- # NOTE(ralonsoh): check the expected output. This test could be
- # incorrect
- # result = {'flow': {'dst_ip0': '152.16.40.2-152.16.40.254',
- # 'src_ip0': '152.16.100.2-152.16.100.254'}}
- self.assertEqual({'flow': {}}, self.s._get_traffic_flow())
+ expected_flow = {'flow': {'dst_ip_0': '152.16.40.2-152.16.40.254',
+ 'public_ip_0': '1.1.1.1',
+ 'src_ip_0': '152.16.100.2-152.16.100.254'}}
+ self.assertEqual(expected_flow, self.s._get_traffic_flow())
def test___get_traffic_flow_error(self):
self.scenario_cfg["traffic_options"]["flow"] = \