aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unit/network_services/vnf_generic/vnf/test_iniparser.py
diff options
context:
space:
mode:
authorabhijitsinha <abhijit.sinha@intel.com>2017-08-28 20:35:46 +0100
committerRoss Brattain <ross.b.brattain@intel.com>2017-09-04 14:49:45 -0700
commita1722f91ac250e2a021b7a1cc4e4f99f11ff41e0 (patch)
tree75e9b060dca5e2e96734bc1e026b76fd3cc4296c /tests/unit/network_services/vnf_generic/vnf/test_iniparser.py
parentc19115bafe0141326b189f317a684bf4681c8bd0 (diff)
Addition of Prox NSB changes in yardstick
JIRA: YARDSTICK-802 Addition of Prox L2Fwd, MPLS test cases for BM and Heat. updates: Most of tg_prox and prox_vnf were absorbed into the base classes. delete most of ProxDpdkVnfSetupEnvHelper, it is handled by DpdkVnfSetupEnvHelper baseclass use standard _build_pipeline_kwargs methods don't use terminate() use baseclass version add new method kill_vnf that runs pkill -x replace resource_helper.execute() with vnf_execture for dumping stats In order to share code between tg_prox and vnf_prox refactor to have tg_prox hold and wrap a ProxApproxVnf instance and call methods on that class. Do this instead of multiple-inheritance. Implement ProxApproxVnf.terminate() using prox socket command based exit, (stop_all, quit, force_quit). vnf_execute calls resource_helper.execute() which calls socket methods on the sut object. Since tg_prox wraps the VNF object, we can call terminate on the VNF object and it should work correctly. move prox config generation to parent process we need to get core number info from config file inside the TG processes, so we need to generate the config in the parent process so the data is copied to the child during the fork. moved more config file methods to the setup_helper class. we run force_quit after quit, so the socket should already be closed this will trigger socket error, so add _ignore_errors option for vnf_execute to ignore socket errors Fixed the terminate issue. Added MPLS tests. Added TG Stats in_packet/out_packet Fixed compile (pep8) issues Fixed MPLS TG port stats, in/out packets Added Grafana dashboards for L2FWD and MPLS Traffic profiles modified for tolerated loss and precision as per DATS tests. Added unit test case for Mpls Single port test stats collection support. Change-Id: Idd9493f597c668a3bb7d90e167e6a418546106e8 Signed-off-by: Abhijit Sinha <abhijit.sinha@intel.com> Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
Diffstat (limited to 'tests/unit/network_services/vnf_generic/vnf/test_iniparser.py')
-rw-r--r--tests/unit/network_services/vnf_generic/vnf/test_iniparser.py65
1 files changed, 35 insertions, 30 deletions
diff --git a/tests/unit/network_services/vnf_generic/vnf/test_iniparser.py b/tests/unit/network_services/vnf_generic/vnf/test_iniparser.py
index b74e5d9fd..15d6adea1 100644
--- a/tests/unit/network_services/vnf_generic/vnf/test_iniparser.py
+++ b/tests/unit/network_services/vnf_generic/vnf/test_iniparser.py
@@ -45,6 +45,7 @@ key4=
[section2]
# here is a comment line
list2: value5
+key with no value
; another comment line
key5=
"""
@@ -69,15 +70,10 @@ PARSE_TEXT_BAD_3 = """\
PARSE_TEXT_BAD_4 = """\
[section1]
-no list or key
-"""
-
-PARSE_TEXT_BAD_5 = """\
-[section1]
bad continuation
"""
-PARSE_TEXT_BAD_6 = """\
+PARSE_TEXT_BAD_5 = """\
[section1]
=value with no key
"""
@@ -106,7 +102,7 @@ class TestBaseParser(unittest.TestCase):
parser = BaseParser()
- self.assertIsNone(parser.parse())
+ parser.parse([])
def test_not_implemented_methods(self):
parser = BaseParser()
@@ -132,39 +128,49 @@ class TestConfigParser(unittest.TestCase):
def test_parse(self, mock_open):
mock_open.side_effect = self.make_open(PARSE_TEXT_1)
- config_parser = ConfigParser('my_file', {})
+ config_parser = ConfigParser('my_file', [])
config_parser.parse()
- expected = {
- 'section1': [
- ['key1', 'value1'],
- ['list1', 'value2\nvalue3\nvalue4'],
- ['key2', 'double quote value'],
- ['key3', 'single quote value'],
- ['key4', ''],
+ expected = [
+ [
+ 'section1',
+ [
+ ['key1', 'value1'],
+ ['list1', 'value2\nvalue3\nvalue4'],
+ ['key2', 'double quote value'],
+ ['key3', 'single quote value'],
+ ['key4', ''],
+ ],
],
- 'section2': [
- ['list2', 'value5'],
- ['key5', ''],
+ [
+ 'section2',
+ [
+ ['list2', 'value5'],
+ ['key with no value', '@'],
+ ['key5', ''],
+ ],
],
- }
+ ]
- self.assertDictEqual(config_parser.sections, expected)
+ self.assertEqual(config_parser.sections, expected)
@mock.patch('yardstick.network_services.vnf_generic.vnf.iniparser.open')
def test_parse_2(self, mock_open):
mock_open.side_effect = self.make_open(PARSE_TEXT_2)
- config_parser = ConfigParser('my_file', {})
+ config_parser = ConfigParser('my_file', [])
config_parser.parse()
- expected = {
- 'section1': [
- ['list1', 'item1\nitem2\nended by eof'],
+ expected = [
+ [
+ 'section1',
+ [
+ ['list1', 'item1\nitem2\nended by eof'],
+ ],
],
- }
+ ]
- self.assertDictEqual(config_parser.sections, expected)
+ self.assertEqual(config_parser.sections, expected)
@mock.patch('yardstick.network_services.vnf_generic.vnf.iniparser.open')
def test_parse_negative(self, mock_open):
@@ -172,15 +178,14 @@ class TestConfigParser(unittest.TestCase):
'no section': PARSE_TEXT_BAD_1,
'incomplete section': PARSE_TEXT_BAD_2,
'empty section name': PARSE_TEXT_BAD_3,
- 'no list or key': PARSE_TEXT_BAD_4,
- 'bad_continuation': PARSE_TEXT_BAD_5,
- 'value with no key': PARSE_TEXT_BAD_6,
+ 'bad_continuation': PARSE_TEXT_BAD_4,
+ 'value with no key': PARSE_TEXT_BAD_5,
}
for bad_reason, bad_text in bad_text_dict.items():
mock_open.side_effect = self.make_open(bad_text)
- config_parser = ConfigParser('my_file', {})
+ config_parser = ConfigParser('my_file', [])
try:
# TODO: replace with assertRaises, when the UT framework supports