Ignore gre devices when fetching devices in test_cleanup_stale_devices

They may show up in namespaces depending on kernel modules loaded.

Change-Id: I78892244d17c4ab7421d3eae9bdeeec1e69690bc
Related-Bug: #1604115
This commit is contained in:
Ihar Hrachyshka 2017-04-07 13:07:33 -07:00
parent 9c45d5dab6
commit 5c286f590f

View File

@ -12,6 +12,8 @@
# License for the specific language governing permissions and limitations
# under the License.
import functools
import mock
from oslo_config import cfg
@ -75,16 +77,19 @@ class TestDhcp(functional_base.BaseSudoTestCase):
"10:22:33:44:55:69",
namespace="qdhcp-foo_id")
ipw = ip_lib.IPWrapper(namespace="qdhcp-foo_id")
devices = ipw.get_devices(exclude_loopback=True)
get_devices = functools.partial(
ipw.get_devices,
exclude_loopback=True, exclude_gre_devices=True)
devices = get_devices()
self.addCleanup(ipw.netns.delete, 'qdhcp-foo_id')
self.assertEqual(sorted(["tapfoo_id2", "tapfoo_id3"]),
sorted(map(str, devices)))
# setting up dhcp for the network
dev_mgr.setup(tests_base.AttributeDict(network))
common_utils.wait_until_true(
lambda: 1 == len(ipw.get_devices(exclude_loopback=True)),
lambda: 1 == len(get_devices()),
timeout=5,
sleep=0.1,
exception=RuntimeError("only one non-loopback device must remain"))
devices = ipw.get_devices(exclude_loopback=True)
devices = get_devices()
self.assertEqual("tapfoo_port_id", devices[0].name)