Bump the minimum pyroute2 version to 0.7.3

This patch also removes the pylint disablement message control
statements and imports NetNS and IPRoute from the new locations
in pyroute2.

Trivial-Fix

Change-Id: I298a7da767473c236ddf03c5702a2904d4870284
This commit is contained in:
Rodolfo Alonso Hernandez 2023-01-18 02:21:41 +01:00
parent b71b25820b
commit 1d84aaf877
12 changed files with 64 additions and 70 deletions

View File

@ -21,8 +21,7 @@ from neutron_lib.plugins.ml2 import ovs_constants
from neutron_lib.utils import helpers from neutron_lib.utils import helpers
from oslo_config import cfg from oslo_config import cfg
from oslo_log import log as logging from oslo_log import log as logging
from pyroute2.netlink import exceptions \ from pyroute2.netlink import exceptions as netlink_exceptions
as netlink_exceptions # pylint: disable=no-name-in-module
from neutron.agent.linux import bridge_lib from neutron.agent.linux import bridge_lib
from neutron.conf.agent import l2_ext_fdb_population from neutron.conf.agent import l2_ext_fdb_population

View File

@ -19,8 +19,7 @@ import netaddr
from neutron_lib import constants as lib_constants from neutron_lib import constants as lib_constants
from oslo_log import log as logging from oslo_log import log as logging
from oslo_utils import excutils from oslo_utils import excutils
from pyroute2.netlink import exceptions \ from pyroute2.netlink import exceptions as pyroute2_exc
as pyroute2_exc # pylint: disable=no-name-in-module
from neutron.agent.l3 import dvr_fip_ns from neutron.agent.l3 import dvr_fip_ns
from neutron.agent.l3 import dvr_router_base from neutron.agent.l3 import dvr_router_base

View File

@ -21,8 +21,7 @@ from neutron_lib.exceptions import l3 as l3_exc
from neutron_lib.utils import helpers from neutron_lib.utils import helpers
from oslo_log import log as logging from oslo_log import log as logging
from oslo_utils import netutils from oslo_utils import netutils
from pyroute2.netlink import exceptions \ from pyroute2.netlink import exceptions as pyroute2_exc
as pyroute2_exc # pylint: disable=no-name-in-module
from neutron._i18n import _ from neutron._i18n import _
from neutron.agent.l3 import namespaces from neutron.agent.l3 import namespaces

View File

@ -20,8 +20,7 @@ import collections
import functools import functools
import os import os
from pyroute2.netlink import exceptions \ from pyroute2.netlink import exceptions as netlink_exceptions
as netlink_exceptions # pylint: disable=no-name-in-module
from neutron.agent.linux import ip_lib from neutron.agent.linux import ip_lib
from neutron.agent.linux import utils as linux_utils from neutron.agent.linux import utils as linux_utils

View File

@ -24,8 +24,7 @@ from neutron_lib import exceptions
from neutron_lib.plugins.ml2 import ovs_constants as ovs_const from neutron_lib.plugins.ml2 import ovs_constants as ovs_const
from oslo_log import log as logging from oslo_log import log as logging
from oslo_utils import excutils from oslo_utils import excutils
from pyroute2.netlink import exceptions \ from pyroute2.netlink import exceptions as pyroute2_exc
as pyroute2_exc # pylint: disable=no-name-in-module
from neutron._i18n import _ from neutron._i18n import _
from neutron.agent.common import ovs_lib from neutron.agent.common import ovs_lib

View File

@ -26,13 +26,11 @@ from neutron_lib import exceptions
from oslo_config import cfg from oslo_config import cfg
from oslo_log import log as logging from oslo_log import log as logging
from oslo_utils import netutils from oslo_utils import netutils
from pyroute2.netlink import exceptions \ from pyroute2.netlink import exceptions as netlink_exceptions
as netlink_exceptions # pylint: disable=no-name-in-module from pyroute2.netlink import rtnl
from pyroute2.netlink import rtnl # pylint: disable=no-name-in-module from pyroute2.netlink.rtnl import ifaddrmsg
from pyroute2.netlink.rtnl import \ from pyroute2.netlink.rtnl import ifinfmsg
ifaddrmsg # pylint: disable=no-name-in-module from pyroute2 import netns
from pyroute2.netlink.rtnl import ifinfmsg # pylint: disable=no-name-in-module
from pyroute2 import netns # pylint: disable=no-name-in-module
from neutron._i18n import _ from neutron._i18n import _
from neutron.agent.common import utils from neutron.agent.common import utils

View File

@ -21,11 +21,9 @@ from neutron_lib import exceptions
from neutron_lib.exceptions import qos as qos_exc from neutron_lib.exceptions import qos as qos_exc
from neutron_lib.services.qos import constants as qos_consts from neutron_lib.services.qos import constants as qos_consts
from oslo_log import log as logging from oslo_log import log as logging
from pyroute2.iproute import linux \ from pyroute2.iproute import linux as iproute_linux
as iproute_linux # pylint: disable=no-name-in-module from pyroute2.netlink import rtnl
from pyroute2.netlink import rtnl # pylint: disable=no-name-in-module from pyroute2.netlink.rtnl.tcmsg import common as rtnl_common
from pyroute2.netlink.rtnl.tcmsg import common \
as rtnl_common # pylint: disable=no-name-in-module
from neutron._i18n import _ from neutron._i18n import _
from neutron.agent.linux import ip_lib from neutron.agent.linux import ip_lib

View File

@ -17,14 +17,13 @@ import socket
import netaddr import netaddr
from neutron_lib import constants from neutron_lib import constants
from oslo_log import log as logging from oslo_log import log as logging
import pyroute2 from pyroute2 import iproute
from pyroute2 import netlink # pylint: disable=no-name-in-module from pyroute2.netlink import exceptions as netlink_exceptions
from pyroute2.netlink import exceptions \ from pyroute2.netlink import rtnl
as netlink_exceptions # pylint: disable=no-name-in-module from pyroute2.netlink.rtnl import ifinfmsg
from pyroute2.netlink import rtnl # pylint: disable=no-name-in-module from pyroute2.netlink.rtnl import ndmsg
from pyroute2.netlink.rtnl import ifinfmsg # pylint: disable=no-name-in-module from pyroute2 import netns
from pyroute2.netlink.rtnl import ndmsg # pylint: disable=no-name-in-module from pyroute2.nslink import nslink
from pyroute2 import netns # pylint: disable=no-name-in-module
import tenacity import tenacity
from neutron._i18n import _ from neutron._i18n import _
@ -147,15 +146,15 @@ def get_iproute(namespace):
# `NetNS` -- RTNL API to another network namespace # `NetNS` -- RTNL API to another network namespace
if namespace: if namespace:
# do not try and create the namespace # do not try and create the namespace
return pyroute2.NetNS(namespace, flags=0, libc=priv_linux.get_cdll()) return nslink.NetNS(namespace, flags=0, libc=priv_linux.get_cdll())
else: else:
return pyroute2.IPRoute() return iproute.IPRoute()
@privileged.default.entrypoint @privileged.default.entrypoint
def open_namespace(namespace): def open_namespace(namespace):
"""Open namespace to test if the namespace is ready to be manipulated""" """Open namespace to test if the namespace is ready to be manipulated"""
with pyroute2.NetNS(namespace, flags=0): with nslink.NetNS(namespace, flags=0):
pass pass
@ -213,7 +212,7 @@ def _run_iproute_link(command, device, namespace=None, **kwargs):
with get_iproute(namespace) as ip: with get_iproute(namespace) as ip:
idx = get_link_id(device, namespace) idx = get_link_id(device, namespace)
return ip.link(command, index=idx, **kwargs) return ip.link(command, index=idx, **kwargs)
except netlink.NetlinkError as e: except netlink_exceptions.NetlinkError as e:
_translate_ip_device_exception(e, device, namespace) _translate_ip_device_exception(e, device, namespace)
raise raise
except OSError as e: except OSError as e:

View File

@ -17,8 +17,7 @@ import socket
from neutron_lib import constants as n_constants from neutron_lib import constants as n_constants
import pyroute2 import pyroute2
from pyroute2 import protocols \ from pyroute2 import protocols as pyroute2_protocols
as pyroute2_protocols # pylint: disable=no-name-in-module
from neutron._i18n import _ from neutron._i18n import _
from neutron import privileged from neutron import privileged

View File

@ -23,11 +23,11 @@ from neutron_lib import constants
from neutron_lib import exceptions from neutron_lib import exceptions
from oslo_utils import netutils from oslo_utils import netutils
from oslo_utils import uuidutils from oslo_utils import uuidutils
import pyroute2 from pyroute2.netlink import exceptions as netlink_exceptions
from pyroute2.netlink.rtnl import ifinfmsg from pyroute2.netlink.rtnl import ifinfmsg
from pyroute2.netlink.rtnl import ndmsg from pyroute2.netlink.rtnl import ndmsg
from pyroute2 import NetlinkError
from pyroute2 import netns from pyroute2 import netns
from pyroute2.nslink import nslink
import testtools import testtools
from neutron.agent.common import utils # noqa from neutron.agent.common import utils # noqa
@ -957,7 +957,7 @@ class TestIpNeighCommand(TestIPCmdBase):
self.addCleanup(privileged.default.set_client_mode, True) self.addCleanup(privileged.default.set_client_mode, True)
privileged.default.set_client_mode(False) privileged.default.set_client_mode(False)
@mock.patch.object(pyroute2, 'NetNS') @mock.patch.object(nslink, 'NetNS')
def test_add_entry(self, mock_netns): def test_add_entry(self, mock_netns):
mock_netns_instance = mock_netns.return_value mock_netns_instance = mock_netns.return_value
mock_netns_enter = mock_netns_instance.__enter__.return_value mock_netns_enter = mock_netns_instance.__enter__.return_value
@ -972,20 +972,20 @@ class TestIpNeighCommand(TestIPCmdBase):
ifindex=1, ifindex=1,
state=ndmsg.states['permanent']) state=ndmsg.states['permanent'])
@mock.patch.object(pyroute2, 'NetNS') @mock.patch.object(nslink, 'NetNS')
def test_add_entry_nonexistent_namespace(self, mock_netns): def test_add_entry_nonexistent_namespace(self, mock_netns):
mock_netns.side_effect = OSError(errno.ENOENT, None) mock_netns.side_effect = OSError(errno.ENOENT, None)
with testtools.ExpectedException(ip_lib.NetworkNamespaceNotFound): with testtools.ExpectedException(ip_lib.NetworkNamespaceNotFound):
self.neigh_cmd.add('192.168.45.100', 'cc:dd:ee:ff:ab:cd') self.neigh_cmd.add('192.168.45.100', 'cc:dd:ee:ff:ab:cd')
@mock.patch.object(pyroute2, 'NetNS') @mock.patch.object(nslink, 'NetNS')
def test_add_entry_other_error(self, mock_netns): def test_add_entry_other_error(self, mock_netns):
expected_exception = OSError(errno.EACCES, None) expected_exception = OSError(errno.EACCES, None)
mock_netns.side_effect = expected_exception mock_netns.side_effect = expected_exception
with testtools.ExpectedException(expected_exception.__class__): with testtools.ExpectedException(expected_exception.__class__):
self.neigh_cmd.add('192.168.45.100', 'cc:dd:ee:ff:ab:cd') self.neigh_cmd.add('192.168.45.100', 'cc:dd:ee:ff:ab:cd')
@mock.patch.object(pyroute2, 'NetNS') @mock.patch.object(nslink, 'NetNS')
def test_delete_entry(self, mock_netns): def test_delete_entry(self, mock_netns):
mock_netns_instance = mock_netns.return_value mock_netns_instance = mock_netns.return_value
mock_netns_enter = mock_netns_instance.__enter__.return_value mock_netns_enter = mock_netns_instance.__enter__.return_value
@ -1002,10 +1002,11 @@ class TestIpNeighCommand(TestIPCmdBase):
@mock.patch.object(priv_lib, '_run_iproute_neigh') @mock.patch.object(priv_lib, '_run_iproute_neigh')
def test_delete_entry_not_exist(self, mock_run_iproute): def test_delete_entry_not_exist(self, mock_run_iproute):
# trying to delete a non-existent entry shouldn't raise an error # trying to delete a non-existent entry shouldn't raise an error
mock_run_iproute.side_effect = NetlinkError(errno.ENOENT, None) mock_run_iproute.side_effect = netlink_exceptions.NetlinkError(
errno.ENOENT, None)
self.neigh_cmd.delete('192.168.45.100', 'cc:dd:ee:ff:ab:cd') self.neigh_cmd.delete('192.168.45.100', 'cc:dd:ee:ff:ab:cd')
@mock.patch.object(pyroute2, 'NetNS') @mock.patch.object(nslink, 'NetNS')
def test_dump_entries(self, mock_netns): def test_dump_entries(self, mock_netns):
mock_netns_instance = mock_netns.return_value mock_netns_instance = mock_netns.return_value
mock_netns_enter = mock_netns_instance.__enter__.return_value mock_netns_enter = mock_netns_instance.__enter__.return_value

View File

@ -15,9 +15,10 @@
import errno import errno
from unittest import mock from unittest import mock
import pyroute2 from pyroute2 import iproute
from pyroute2 import netlink from pyroute2 import netlink
from pyroute2.netlink import exceptions as netlink_exceptions from pyroute2.netlink import exceptions as netlink_exceptions
from pyroute2.nslink import nslink
from neutron.privileged.agent.linux import ip_lib as priv_lib from neutron.privileged.agent.linux import ip_lib as priv_lib
from neutron.tests import base from neutron.tests import base
@ -27,7 +28,8 @@ class IpLibTestCase(base.BaseTestCase):
def _test_run_iproute_link(self, namespace=None): def _test_run_iproute_link(self, namespace=None):
ip_obj = "NetNS" if namespace else "IPRoute" ip_obj = "NetNS" if namespace else "IPRoute"
with mock.patch.object(pyroute2, ip_obj) as ip_mock_cls: _mod = nslink if namespace else iproute
with mock.patch.object(_mod, ip_obj) as ip_mock_cls:
ip_mock = ip_mock_cls() ip_mock = ip_mock_cls()
ip_mock.__enter__().link_lookup.return_value = [2] ip_mock.__enter__().link_lookup.return_value = [2]
priv_lib._run_iproute_link("test_cmd", "eth0", namespace, priv_lib._run_iproute_link("test_cmd", "eth0", namespace,
@ -45,7 +47,7 @@ class IpLibTestCase(base.BaseTestCase):
self._test_run_iproute_link(namespace="testns") self._test_run_iproute_link(namespace="testns")
def test_run_iproute_link_interface_not_exists(self): def test_run_iproute_link_interface_not_exists(self):
with mock.patch.object(pyroute2, "IPRoute") as iproute_mock: with mock.patch.object(iproute, "IPRoute") as iproute_mock:
ip_mock = iproute_mock() ip_mock = iproute_mock()
ret_values = [ ret_values = [
[], # No interface found. [], # No interface found.
@ -67,29 +69,29 @@ class IpLibTestCase(base.BaseTestCase):
priv_lib.get_link_id('device', 'namespace')) priv_lib.get_link_id('device', 'namespace'))
def test_run_iproute_link_interface_removed_during_call(self): def test_run_iproute_link_interface_removed_during_call(self):
with mock.patch.object(pyroute2, "IPRoute") as iproute_mock: with mock.patch.object(iproute, "IPRoute") as iproute_mock:
ip_mock = iproute_mock() ip_mock = iproute_mock()
ip_mock.__enter__().link_lookup.return_value = [2] ip_mock.__enter__().link_lookup.return_value = [2]
ip_mock.__enter__().link.side_effect = pyroute2.NetlinkError( ip_mock.__enter__().link.side_effect = (
code=errno.ENODEV) netlink_exceptions.NetlinkError(code=errno.ENODEV))
self.assertRaises( self.assertRaises(
priv_lib.NetworkInterfaceNotFound, priv_lib.NetworkInterfaceNotFound,
priv_lib._run_iproute_link, priv_lib._run_iproute_link,
"test_cmd", "eth0", None, test_param="test_value") "test_cmd", "eth0", None, test_param="test_value")
def test_run_iproute_link_op_not_supported(self): def test_run_iproute_link_op_not_supported(self):
with mock.patch.object(pyroute2, "IPRoute") as iproute_mock: with mock.patch.object(iproute, "IPRoute") as iproute_mock:
ip_mock = iproute_mock() ip_mock = iproute_mock()
ip_mock.__enter__().link_lookup.return_value = [2] ip_mock.__enter__().link_lookup.return_value = [2]
ip_mock.__enter__().link.side_effect = pyroute2.NetlinkError( ip_mock.__enter__().link.side_effect = (
code=errno.EOPNOTSUPP) netlink_exceptions.NetlinkError(code=errno.EOPNOTSUPP))
self.assertRaises( self.assertRaises(
priv_lib.InterfaceOperationNotSupported, priv_lib.InterfaceOperationNotSupported,
priv_lib._run_iproute_link, priv_lib._run_iproute_link,
"test_cmd", "eth0", None, test_param="test_value") "test_cmd", "eth0", None, test_param="test_value")
def test_run_iproute_link_namespace_not_exists(self): def test_run_iproute_link_namespace_not_exists(self):
with mock.patch.object(pyroute2, "IPRoute") as iproute_mock: with mock.patch.object(iproute, "IPRoute") as iproute_mock:
iproute_mock.side_effect = OSError( iproute_mock.side_effect = OSError(
errno.ENOENT, "Test no netns exception") errno.ENOENT, "Test no netns exception")
self.assertRaises( self.assertRaises(
@ -98,7 +100,7 @@ class IpLibTestCase(base.BaseTestCase):
"test_cmd", "eth0", None, test_param="test_value") "test_cmd", "eth0", None, test_param="test_value")
def test_run_iproute_link_error(self): def test_run_iproute_link_error(self):
with mock.patch.object(pyroute2, "IPRoute") as iproute_mock: with mock.patch.object(iproute, "IPRoute") as iproute_mock:
iproute_mock.side_effect = OSError( iproute_mock.side_effect = OSError(
errno.EINVAL, "Test invalid argument exception") errno.EINVAL, "Test invalid argument exception")
try: try:
@ -110,7 +112,8 @@ class IpLibTestCase(base.BaseTestCase):
def _test_run_iproute_neigh(self, namespace=None): def _test_run_iproute_neigh(self, namespace=None):
ip_obj = "NetNS" if namespace else "IPRoute" ip_obj = "NetNS" if namespace else "IPRoute"
with mock.patch.object(pyroute2, ip_obj) as ip_mock_cls: _mod = nslink if namespace else iproute
with mock.patch.object(_mod, ip_obj) as ip_mock_cls:
ip_mock = ip_mock_cls() ip_mock = ip_mock_cls()
ip_mock.__enter__().link_lookup.return_value = [2] ip_mock.__enter__().link_lookup.return_value = [2]
priv_lib._run_iproute_neigh("test_cmd", "eth0", namespace, priv_lib._run_iproute_neigh("test_cmd", "eth0", namespace,
@ -128,7 +131,7 @@ class IpLibTestCase(base.BaseTestCase):
self._test_run_iproute_neigh(namespace="testns") self._test_run_iproute_neigh(namespace="testns")
def test_run_iproute_neigh_interface_not_exists(self): def test_run_iproute_neigh_interface_not_exists(self):
with mock.patch.object(pyroute2, "IPRoute") as iproute_mock: with mock.patch.object(iproute, "IPRoute") as iproute_mock:
ip_mock = iproute_mock() ip_mock = iproute_mock()
ip_mock.__enter__().link_lookup.return_value = [] ip_mock.__enter__().link_lookup.return_value = []
self.assertRaises( self.assertRaises(
@ -137,18 +140,18 @@ class IpLibTestCase(base.BaseTestCase):
"test_cmd", "eth0", None, test_param="test_value") "test_cmd", "eth0", None, test_param="test_value")
def test_run_iproute_neigh_interface_removed_during_call(self): def test_run_iproute_neigh_interface_removed_during_call(self):
with mock.patch.object(pyroute2, "IPRoute") as iproute_mock: with mock.patch.object(iproute, "IPRoute") as iproute_mock:
ip_mock = iproute_mock() ip_mock = iproute_mock()
ip_mock.__enter__().link_lookup.return_value = [2] ip_mock.__enter__().link_lookup.return_value = [2]
ip_mock.__enter__().neigh.side_effect = pyroute2.NetlinkError( ip_mock.__enter__().neigh.side_effect = (
code=errno.ENODEV) netlink_exceptions.NetlinkError(code=errno.ENODEV))
self.assertRaises( self.assertRaises(
priv_lib.NetworkInterfaceNotFound, priv_lib.NetworkInterfaceNotFound,
priv_lib._run_iproute_neigh, priv_lib._run_iproute_neigh,
"test_cmd", "eth0", None, test_param="test_value") "test_cmd", "eth0", None, test_param="test_value")
def test_run_iproute_neigh_namespace_not_exists(self): def test_run_iproute_neigh_namespace_not_exists(self):
with mock.patch.object(pyroute2, "IPRoute") as iproute_mock: with mock.patch.object(iproute, "IPRoute") as iproute_mock:
iproute_mock.side_effect = OSError( iproute_mock.side_effect = OSError(
errno.ENOENT, "Test no netns exception") errno.ENOENT, "Test no netns exception")
self.assertRaises( self.assertRaises(
@ -157,7 +160,7 @@ class IpLibTestCase(base.BaseTestCase):
"test_cmd", "eth0", None, test_param="test_value") "test_cmd", "eth0", None, test_param="test_value")
def test_run_iproute_neigh_error(self): def test_run_iproute_neigh_error(self):
with mock.patch.object(pyroute2, "IPRoute") as iproute_mock: with mock.patch.object(iproute, "IPRoute") as iproute_mock:
iproute_mock.side_effect = OSError( iproute_mock.side_effect = OSError(
errno.EINVAL, "Test invalid argument exception") errno.EINVAL, "Test invalid argument exception")
try: try:
@ -169,7 +172,8 @@ class IpLibTestCase(base.BaseTestCase):
def _test_run_iproute_addr(self, namespace=None): def _test_run_iproute_addr(self, namespace=None):
ip_obj = "NetNS" if namespace else "IPRoute" ip_obj = "NetNS" if namespace else "IPRoute"
with mock.patch.object(pyroute2, ip_obj) as ip_mock_cls: _mod = nslink if namespace else iproute
with mock.patch.object(_mod, ip_obj) as ip_mock_cls:
ip_mock = ip_mock_cls() ip_mock = ip_mock_cls()
ip_mock.__enter__().link_lookup.return_value = [2] ip_mock.__enter__().link_lookup.return_value = [2]
priv_lib._run_iproute_addr("test_cmd", "eth0", namespace, priv_lib._run_iproute_addr("test_cmd", "eth0", namespace,
@ -187,7 +191,7 @@ class IpLibTestCase(base.BaseTestCase):
self._test_run_iproute_addr(namespace="testns") self._test_run_iproute_addr(namespace="testns")
def test_run_iproute_addr_interface_not_exists(self): def test_run_iproute_addr_interface_not_exists(self):
with mock.patch.object(pyroute2, "IPRoute") as iproute_mock: with mock.patch.object(iproute, "IPRoute") as iproute_mock:
ip_mock = iproute_mock() ip_mock = iproute_mock()
ip_mock.__enter__().link_lookup.return_value = [] ip_mock.__enter__().link_lookup.return_value = []
self.assertRaises( self.assertRaises(
@ -196,18 +200,18 @@ class IpLibTestCase(base.BaseTestCase):
"test_cmd", "eth0", None, test_param="test_value") "test_cmd", "eth0", None, test_param="test_value")
def test_run_iproute_addr_interface_removed_during_call(self): def test_run_iproute_addr_interface_removed_during_call(self):
with mock.patch.object(pyroute2, "IPRoute") as iproute_mock: with mock.patch.object(iproute, "IPRoute") as iproute_mock:
ip_mock = iproute_mock() ip_mock = iproute_mock()
ip_mock.__enter__().link_lookup.return_value = [2] ip_mock.__enter__().link_lookup.return_value = [2]
ip_mock.__enter__().addr.side_effect = pyroute2.NetlinkError( ip_mock.__enter__().addr.side_effect = (
code=errno.ENODEV) netlink_exceptions.NetlinkError(code=errno.ENODEV))
self.assertRaises( self.assertRaises(
priv_lib.NetworkInterfaceNotFound, priv_lib.NetworkInterfaceNotFound,
priv_lib._run_iproute_addr, priv_lib._run_iproute_addr,
"test_cmd", "eth0", None, test_param="test_value") "test_cmd", "eth0", None, test_param="test_value")
def test_run_iproute_addr_namespace_not_exists(self): def test_run_iproute_addr_namespace_not_exists(self):
with mock.patch.object(pyroute2, "IPRoute") as iproute_mock: with mock.patch.object(iproute, "IPRoute") as iproute_mock:
iproute_mock.side_effect = OSError( iproute_mock.side_effect = OSError(
errno.ENOENT, "Test no netns exception") errno.ENOENT, "Test no netns exception")
self.assertRaises( self.assertRaises(
@ -216,7 +220,7 @@ class IpLibTestCase(base.BaseTestCase):
"test_cmd", "eth0", None, test_param="test_value") "test_cmd", "eth0", None, test_param="test_value")
def test_run_iproute_addr_error(self): def test_run_iproute_addr_error(self):
with mock.patch.object(pyroute2, "IPRoute") as iproute_mock: with mock.patch.object(iproute, "IPRoute") as iproute_mock:
iproute_mock.side_effect = OSError( iproute_mock.side_effect = OSError(
errno.EINVAL, "Test invalid argument exception") errno.EINVAL, "Test invalid argument exception")
try: try:

View File

@ -53,7 +53,7 @@ ovs>=2.10.0 # Apache-2.0
ovsdbapp>=1.16.0 # Apache-2.0 ovsdbapp>=1.16.0 # Apache-2.0
packaging>=20.4 # Apache-2.0 packaging>=20.4 # Apache-2.0
psutil>=5.3.0 # BSD psutil>=5.3.0 # BSD
pyroute2>=0.6.6;sys_platform!='win32' # Apache-2.0 (+ dual licensed GPL2) pyroute2>=0.7.3;sys_platform!='win32' # Apache-2.0 (+ dual licensed GPL2)
pyOpenSSL>=17.1.0 # Apache-2.0 pyOpenSSL>=17.1.0 # Apache-2.0
python-novaclient>=9.1.0 # Apache-2.0 python-novaclient>=9.1.0 # Apache-2.0