From 9340e59fa0e93c354d570acb03ba21daf39c4825 Mon Sep 17 00:00:00 2001 From: Rodolfo Alonso Hernandez Date: Mon, 21 Jan 2019 12:36:35 +0000 Subject: [PATCH] Add test to check os_vif.internal.command.ip.exists Related-Bug: #1812090 Change-Id: Ifc828307bca96850af490f54bf4dc41b02555284 --- .../internal/command/ip/test_impl_pyroute2.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/os_vif/tests/functional/internal/command/ip/test_impl_pyroute2.py b/os_vif/tests/functional/internal/command/ip/test_impl_pyroute2.py index 373816d1..9539c238 100644 --- a/os_vif/tests/functional/internal/command/ip/test_impl_pyroute2.py +++ b/os_vif/tests/functional/internal/command/ip/test_impl_pyroute2.py @@ -109,6 +109,11 @@ def _ip_cmd_delete(*args, **kwargs): ip_lib.delete(*args, **kwargs) +@privsep.os_vif_pctxt.entrypoint +def _ip_cmd_exists(*args, **kwargs): + return ip_lib.exists(*args, **kwargs) + + class TestIpCommand(ShellIpCommands, base.BaseFunctionalTestCase): def setUp(self): @@ -192,3 +197,11 @@ class TestIpCommand(ShellIpCommands, base.BaseFunctionalTestCase): for _ in range(300): _ip_cmd_add(device, 'vlan', link=link, vlan_id=100) _ip_cmd_delete(device) + + def test_exists(self): + device = "test_dev_10" + self.addCleanup(self.del_device, device) + self.add_device(device, 'dummy') + self.assertTrue(_ip_cmd_exists(device)) + self.del_device(device) + self.assertFalse(_ip_cmd_exists(device))