diff options
author | 2017-10-03 23:20:03 -0400 | |
---|---|---|
committer | 2018-04-01 00:34:59 -0400 | |
commit | 1c50db100a7b7ff797a5ab7e1a6f7567adeb658e (patch) | |
tree | 4d8747f2d4574d9b6be0327f733aa6a4f9ca9195 /os_net_config/tests | |
parent | a301f9f0fff8b227562fdec639e66d76dafb4634 (diff) |
VPP sometimes takes some time to come up, this causes VPP interface detection
to fail. This patch adds retries for interface discovery so we can properly
identify state of VPP interfaces.
Also contains minor fixes for regex for VPP configs generation code to prevent
cases where we might edit configs that are commented out.
Change-Id: I915d5455acb8d496438b9c9e851639d3a43e6fa9
Signed-off-by: Feng Pan <fpan@redhat.com>
Diffstat (limited to 'os_net_config/tests')
-rw-r--r-- | os_net_config/tests/test_utils.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/os_net_config/tests/test_utils.py b/os_net_config/tests/test_utils.py index e09b6f7..10ee3b1 100644 --- a/os_net_config/tests/test_utils.py +++ b/os_net_config/tests/test_utils.py @@ -14,6 +14,7 @@ # License for the specific language governing permissions and limitations # under the License. +import mock import os import os.path import random @@ -354,6 +355,12 @@ class TestUtils(base.TestCase): self.assertRaises(utils.VppException, utils._get_vpp_interface_name, '0000:09.0') + @mock.patch('os_net_config.utils.processutils.execute', + return_value=('', None)) + def test_get_vpp_interface_name_multiple_iterations(self, mock_execute): + self.assertIsNone(utils._get_vpp_interface_name('0000:00:09.0', 2, 1)) + self.assertEqual(4, mock_execute.call_count) + def test_generate_vpp_config(self): tmpdir = tempfile.mkdtemp() config_path = os.path.join(tmpdir, 'startup.conf') @@ -406,7 +413,7 @@ dpdk { return None, None self.stubs.Set(processutils, 'execute', test_execute) - def test_get_vpp_interface_name(pci_dev): + def test_get_vpp_interface_name(pci_dev, tries, timeout): return 'GigabitEthernet0/9/0' self.stubs.Set(utils, '_get_vpp_interface_name', |