aboutsummaryrefslogtreecommitdiffstats
path: root/yardstick/tests/unit/network_services/vnf_generic/vnf
diff options
context:
space:
mode:
authorOrest Voznyy <orestx.voznyy@intel.com>2018-10-22 18:27:31 +0300
committerAbhijit Sinha <abhijit.sinha@intel.com>2018-10-26 10:57:32 +0000
commit1fd3806d6a6bac19f3173da4d6cb94cef81fd7f5 (patch)
tree98079d24df2fe47aa448798d08d5626817a194b1 /yardstick/tests/unit/network_services/vnf_generic/vnf
parenta4084d27de22c64ecb690369c7bed49175703adf (diff)
Add test library name update in DMF and mainflows
Add automatic update of traffic profile items library name update, as well as update of session profile Dmf library name, to avoid the need of user changing it in template files. Update affected unit tests. JIRA: YARDSTICK-1474 Change-Id: I18cc8ca99a47da862753329c87d1a560a97f76fa Signed-off-by: Orest Voznyy <orestx.voznyy@intel.com>
Diffstat (limited to 'yardstick/tests/unit/network_services/vnf_generic/vnf')
-rw-r--r--yardstick/tests/unit/network_services/vnf_generic/vnf/test_tg_landslide.py38
1 files changed, 33 insertions, 5 deletions
diff --git a/yardstick/tests/unit/network_services/vnf_generic/vnf/test_tg_landslide.py b/yardstick/tests/unit/network_services/vnf_generic/vnf/test_tg_landslide.py
index 53439972a..fcf0fa1c1 100644
--- a/yardstick/tests/unit/network_services/vnf_generic/vnf/test_tg_landslide.py
+++ b/yardstick/tests/unit/network_services/vnf_generic/vnf/test_tg_landslide.py
@@ -27,7 +27,7 @@ from yardstick.network_services import utils as net_serv_utils
from yardstick.network_services.traffic_profile import landslide_profile
from yardstick.network_services.vnf_generic.vnf import sample_vnf
from yardstick.network_services.vnf_generic.vnf import tg_landslide
-
+from yardstick.network_services.vnf_generic.vnf import base as vnf_base
NAME = "tg__0"
@@ -465,8 +465,10 @@ class TestLandslideTrafficGen(unittest.TestCase):
self.ls_tg.scenario_helper.scenario_cfg = self.SCENARIO_CFG
mock_traffic_profile = mock.Mock(
spec=landslide_profile.LandslideProfile)
- mock_traffic_profile.dmf_config = {'keywords': 'UDP',
- 'dataProtocol': 'udp'}
+ mock_traffic_profile.dmf_config = {
+ 'keywords': 'UDP',
+ 'dataProtocol': 'udp',
+ 'dmf': {'library': 'test', 'name': 'name'}}
mock_traffic_profile.params = self.TRAFFIC_PROFILE
self.ls_tg.resource_helper._user_id = self.TEST_USER_ID
mock_get_tests.return_value = [{'id': self.SUCCESS_RECORD_ID,
@@ -598,6 +600,28 @@ class TestLandslideTrafficGen(unittest.TestCase):
get_session_tc_param_value(_key, _tc.get('type'),
self.ls_tg.session_profile))
+ def test__update_session_library_name(self, *args):
+ _session = copy.deepcopy(SESSION_PROFILE)
+ _session['tsGroups'].pop(0)
+ self.ls_tg.vnfd_helper = mock.MagicMock()
+ self.ls_tg.vnfd_helper.mgmt_interface.__getitem__.side_effect = {
+ 'user': TAS_INFO['user']}
+ self.ls_tg._update_session_library_name(_session)
+ _dmf = _session['tsGroups'][0]['testCases'][0]['parameters']['Dmf']
+ # Expect DMF library name updated in Nodal test types
+ self.assertEqual(TAS_INFO['user'], _dmf['mainflows'][0]['library'])
+
+ def test__update_session_library_name_wrong_tc_type(self, *args):
+ _session = copy.deepcopy(SESSION_PROFILE)
+ _session['tsGroups'].pop(1)
+ self.ls_tg.vnfd_helper = mock.MagicMock()
+ self.ls_tg.vnfd_helper.mgmt_interface.__getitem__.side_effect = {
+ 'user': TAS_INFO['user']}
+ # Expect DMF library name not updated in Node test types
+ self.assertNotIn('Dmf',
+ _session['tsGroups'][0]['testCases'][0]['parameters'])
+ self.ls_tg._update_session_library_name(_session)
+
@mock.patch.object(common_utils, 'open_relative_file')
@mock.patch.object(yaml_loader, 'yaml_load')
@mock.patch.object(tg_landslide.LandslideTrafficGen,
@@ -986,11 +1010,15 @@ class TestLandslideResourceHelper(unittest.TestCase):
def test_create_dmf(self, *args):
self.res_helper._tcl = mock.Mock()
+ self.res_helper.vnfd_helper = mock.Mock(spec=vnf_base.VnfdHelper)
+ self.res_helper.vnfd_helper.mgmt_interface = {'user': TAS_INFO['user']}
self.assertIsNone(self.res_helper.create_dmf(DMF_CFG))
self.res_helper._tcl.create_dmf.assert_called_once_with(DMF_CFG)
def test_create_dmf_as_list(self, *args):
self.res_helper._tcl = mock.Mock()
+ self.res_helper.vnfd_helper = mock.Mock(spec=vnf_base.VnfdHelper)
+ self.res_helper.vnfd_helper.mgmt_interface = {'user': TAS_INFO['user']}
self.assertIsNone(self.res_helper.create_dmf([DMF_CFG]))
self.res_helper._tcl.create_dmf.assert_called_once_with(DMF_CFG)
@@ -1597,7 +1625,7 @@ class TestLandslideTclClient(unittest.TestCase):
self.mock_tcl_handler.execute.assert_has_calls([
mock.call('set dmf_ [ls::create Dmf]'),
mock.call(
- 'ls::get [ls::query LibraryInfo -systemLibraryName test] -Id'),
+ 'ls::get [ls::query LibraryInfo -systemLibraryName user] -Id'),
mock.call('ls::config $dmf_ -Library 2 -Name "Basic UDP"'),
mock.call('ls::config $dmf_ -dataProtocol "udp"'),
# mock.call(
@@ -1623,7 +1651,7 @@ class TestLandslideTclClient(unittest.TestCase):
self.mock_tcl_handler.execute.assert_has_calls([
mock.call('set dmf_ [ls::create Dmf]'),
mock.call(
- 'ls::get [ls::query LibraryInfo -systemLibraryName test] -Id'),
+ 'ls::get [ls::query LibraryInfo -systemLibraryName user] -Id'),
mock.call('ls::config $dmf_ -Library 2 -Name "Basic UDP"'),
mock.call('ls::config $dmf_ -dataProtocol "udp"'),
# mock.call(