diff options
author | karthik s <ksundara@redhat.com> | 2017-02-15 18:03:14 +0530 |
---|---|---|
committer | Saravanan KR <skramaja@redhat.com> | 2017-03-01 09:26:51 +0000 |
commit | 3bccab387cc1c0cf60480c4f4d2f3f9a8e58e544 (patch) | |
tree | 87e00ad571904cc0433c5633ec1c7b9465b001c5 /os_net_config/tests | |
parent | b4ecaa5c344cc33691d91398bfa187e876e6e40d (diff) |
Restart Openvswitch after adding DPDK ports
OvS needs to be restarted after adding a DPDK port. This change
shall be removed on migration to OvS 2.7 where DPDK Hotplug support
is available.
Co-Authored-By: Saravanan KR <skramaja@redhat.com>
Closes-Bug: #1668375
Signed-off-by: karthik s <ksundara@redhat.com>
Change-Id: I250bb8e9a8e50874a82bf7f159e5a9d5677ef5ac
(cherry picked from commit ab0e0d433fb363f6a01b7c8305771f2bde47930e)
Diffstat (limited to 'os_net_config/tests')
-rw-r--r-- | os_net_config/tests/test_impl_ifcfg.py | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/os_net_config/tests/test_impl_ifcfg.py b/os_net_config/tests/test_impl_ifcfg.py index 9621b8c..6789d85 100644 --- a/os_net_config/tests/test_impl_ifcfg.py +++ b/os_net_config/tests/test_impl_ifcfg.py @@ -20,6 +20,7 @@ import tempfile from oslo_concurrency import processutils from os_net_config import impl_ifcfg +from os_net_config import NetConfig from os_net_config import objects from os_net_config.tests import base from os_net_config import utils @@ -1157,3 +1158,32 @@ class TestIfcfgNetConfigApply(base.TestCase): self.provider.apply(cleanup=True) self.assertTrue(os.path.exists(tmp_lo_file)) os.remove(tmp_lo_file) + + def test_ovs_restart_called(self): + interface = objects.Interface('em1') + dpdk_port = objects.OvsDpdkPort('dpdk0', members=[interface]) + execute_strings = [] + + def test_execute(*args, **kwargs): + execute_strings.append(args[1]) + pass + self.stubs.Set(NetConfig, 'execute', test_execute) + + self.provider.noop = True + self.provider.add_ovs_dpdk_port(dpdk_port) + self.provider.apply() + self.assertIn('Restart openvswitch', execute_strings) + + def test_ovs_restart_not_called(self): + interface = objects.Interface('em1') + execute_strings = [] + + def test_execute(*args, **kwargs): + execute_strings.append(args[1]) + pass + self.stubs.Set(NetConfig, 'execute', test_execute) + + self.provider.noop = True + self.provider.add_interface(interface) + self.provider.apply() + self.assertNotIn('Restart openvswitch', execute_strings) |