diff options
author | gvrangan <venkatrangang@hcl.com> | 2019-01-03 11:32:11 +0000 |
---|---|---|
committer | ananth.y <ananth.y@hcl.com> | 2019-01-25 22:52:13 +0900 |
commit | 50ad0d757b2015067c2b13adbbe59b746477b207 (patch) | |
tree | bb9be072a0cef8fd32898a375285fd2c19844397 /sfc/unit_tests/unit/lib/test_odl_utils.py | |
parent | a4b8b22caf02f46e2019a957af782a4fd77b9bea (diff) |
Fix Two Chains Test and Enabled all Testcases
- Method added to support Port Chain update
- Used the new method to modify the test as follows
- Create two Port Chains (one VNF per chain)
- Block ssh in one vnf and http in the other
- Test communication
- Swap the flow classifiers in the chains
so that ssh packets are sent to vnf where
http is blocked and vice versa
- Fix extracting odl username/password from ml2_conf
- Checking flow classifiers are implemented
- Fixed odl cleanup
Change-Id: I1f0f3a3b829d6c73d1bb1a774ebf3484912b84b7
Signed-off-by: gvrangan <venkatrangang@hcl.com>
Diffstat (limited to 'sfc/unit_tests/unit/lib/test_odl_utils.py')
-rw-r--r-- | sfc/unit_tests/unit/lib/test_odl_utils.py | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/sfc/unit_tests/unit/lib/test_odl_utils.py b/sfc/unit_tests/unit/lib/test_odl_utils.py index 04eeeff2..1dfcf1ed 100644 --- a/sfc/unit_tests/unit/lib/test_odl_utils.py +++ b/sfc/unit_tests/unit/lib/test_odl_utils.py @@ -331,11 +331,35 @@ class SfcOdlUtilsTesting(unittest.TestCase): '/etc/ml2_conf.ini') mock_rawconfigparser.return_value.read.assert_called_once_with( '/etc/ml2_conf.ini') - mock_rawconfigparser.return_value.get.assert_called_once_with( + mock_rawconfigparser.return_value.get.assert_called_with( 'ml2_odl', 'url') mock_search.assert_called_once_with(r'[0-9]+(?:\.[0-9]+){3}\:[0-9]+', 'config') + @patch('re.search', autospec=True) + @patch('ConfigParser.RawConfigParser', autospec=True) + @patch('os.getcwd', autospec=True, return_value='/etc') + @patch('os.path.join', autospec=True, return_value='/etc/ml2_conf.ini') + def test_get_odl_username_password(self, mock_join, + mock_getcwd, + mock_rawconfigparser, + mock_search): + """ + Check the proper functionality of get odl_username_password + function + """ + + mock_rawconfigparser.return_value.get.return_value = 'odl_username' + result = odl_utils.get_odl_username_password() + self.assertEqual(('odl_username'), result[0]) + mock_getcwd.assert_called_once_with() + mock_join.assert_called_once_with('/etc', 'ml2_conf.ini') + mock_rawconfigparser.return_value.read.assert_called_once_with( + '/etc/ml2_conf.ini') + mock_rawconfigparser.return_value.get.return_value = 'odl_password' + result = odl_utils.get_odl_username_password() + self.assertEqual(('odl_password'), result[1]) + def test_pluralize(self): """ Checks the proper functionality of pluralize |