diff options
author | Rodolfo Alonso Hernandez <rodolfo.alonso.hernandez@intel.com> | 2018-08-23 16:13:48 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@opnfv.org> | 2018-08-23 16:13:48 +0000 |
commit | 5b23c7f12857ea6d47f184046010b467949303e6 (patch) | |
tree | 7d17d3b5720fa07e136fbc4ed6f578bbf212b02f | |
parent | 70fa1fcf237ad41d868d8501c5a49d3331ef6adf (diff) | |
parent | eed1b9cca960e7c7a3980d0a94b3589cf6b81eab (diff) |
Merge "Fix setting `flow` configuration in TC yaml"
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 f07973304..461604fb8 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"] = \ |