diff options
author | Deepak S <deepak.s@linux.intel.com> | 2017-08-13 19:15:55 -0700 |
---|---|---|
committer | Ross Brattain <ross.b.brattain@intel.com> | 2017-08-21 19:36:41 -0700 |
commit | 952defd326974e7ae74ce366c6b5d32793d8d70c (patch) | |
tree | 4fb1d20e9a43ddc27e1d841b289162b4e10b8ef8 /tests/unit/benchmark/scenarios | |
parent | 4de16cbc3c7a4e03542c6256f3aeda79dbf49b62 (diff) |
Re-define the framesize and flow dynamic define in testcase
This patch adds the framesize and flow into test option instead of
adding a seperate file to avoid the multiple file update incase of ip
change.
Change-Id: Ic473c73773ad36422ecc02618b8c646a5336b70a
Signed-off-by: Deepak S <deepak.s@linux.intel.com>
Diffstat (limited to 'tests/unit/benchmark/scenarios')
-rw-r--r-- | tests/unit/benchmark/scenarios/networking/test_vnf_generic.py | 34 |
1 files changed, 30 insertions, 4 deletions
diff --git a/tests/unit/benchmark/scenarios/networking/test_vnf_generic.py b/tests/unit/benchmark/scenarios/networking/test_vnf_generic.py index 651614d3e..8ce33625b 100644 --- a/tests/unit/benchmark/scenarios/networking/test_vnf_generic.py +++ b/tests/unit/benchmark/scenarios/networking/test_vnf_generic.py @@ -375,6 +375,9 @@ class TestNetworkServiceTestCase(unittest.TestCase): 'allowed_drop_rate': '0.8 - 1', }, }, + 'options': { + 'framesize': {'64B': 100} + }, 'runner': { 'object': 'NetworkServiceTestCase', 'interval': 35, @@ -414,17 +417,40 @@ class TestNetworkServiceTestCase(unittest.TestCase): def test___init__(self): assert self.topology + def test__get_ip_flow_range(self): + self.scenario_cfg["traffic_options"]["flow"] = \ + self._get_file_abspath("ipv4_1flow_Packets_vpe.yaml") + result = '152.16.100.1-152.16.100.254' + self.assertEqual(result, self.s._get_ip_flow_range({"tg__1": 'xe0'})) + def test___get_traffic_flow(self): self.scenario_cfg["traffic_options"]["flow"] = \ self._get_file_abspath("ipv4_1flow_Packets_vpe.yaml") - result = {'flow': {'dstip4_range': '152.40.0.20', - 'srcip4_range': '152.16.0.20', 'count': 1}} + self.scenario_cfg["options"] = {} + self.scenario_cfg['options'] = { + 'flow': { + 'src_ip': [ + { + 'tg__1': 'xe0', + }, + ], + 'dst_ip': [ + { + 'tg__1': 'xe1', + }, + ], + 'public_ip': ['1.1.1.1'], + }, + } + result = {'flow': {'dst_ip0': '152.16.40.1-152.16.40.254', + 'src_ip0': '152.16.100.1-152.16.100.254'}} + self.assertEqual(result, self.s._get_traffic_flow()) def test___get_traffic_flow_error(self): self.scenario_cfg["traffic_options"]["flow"] = \ "ipv4_1flow_Packets_vpe.yaml1" - self.assertEqual({}, self.s._get_traffic_flow()) + self.assertEqual({'flow': {}}, self.s._get_traffic_flow()) def test_get_vnf_imp(self): vnfd = COMPLETE_TREX_VNFD['vnfd:vnfd-catalog']['vnfd'][0]['class-name'] @@ -586,7 +612,7 @@ class TestNetworkServiceTestCase(unittest.TestCase): def test___get_traffic_imix_exception(self): with mock.patch.dict(self.scenario_cfg["traffic_options"], {'imix': ''}): - self.assertEqual({}, self.s._get_traffic_imix()) + self.assertEqual({'imix': {'64B': 100}}, self.s._get_traffic_imix()) def test__fill_traffic_profile(self): with mock.patch.dict("sys.modules", STL_MOCKS): |