Browse Source

Add compatibility for pyroute2>=0.4.15

Pyroute2 was updated, its change make some testcases failed.
This patch fix the problem with pyroute2 update.

Change-Id: I300f9830927a8babf9112f9aff265ef4b2e5e03e
Closes-Bug: #1700469
Kien Nguyen 1 year ago
parent
commit
df421a9b2e

+ 1
- 1
kuryr/lib/binding/drivers/ipvlan.py View File

@@ -17,7 +17,7 @@ from kuryr.lib.binding.drivers import utils
17 17
 
18 18
 KIND = 'ipvlan'
19 19
 # We use L2 to allow broadcast frames
20
-IPVLAN_MODE_L2 = ifinfmsg.ifinfo.ipvlan_data.modes['IPVLAN_MODE_L2']
20
+IPVLAN_MODE_L2 = ifinfmsg.ifinfo.data_map['ipvlan'].modes['IPVLAN_MODE_L2']
21 21
 
22 22
 
23 23
 def port_bind(endpoint_id, port, subnets, network=None, vm_port=None,

+ 2
- 2
kuryr/tests/unit/binding/drivers/test_ipvlan.py View File

@@ -28,9 +28,9 @@ class TestIpvlanDriver(base.TestCase):
28 28
     """Unit tests for nested IPVLAN driver"""
29 29
 
30 30
     @mock.patch('kuryr.lib.binding.drivers.utils._configure_container_iface')
31
-    @mock.patch('pyroute2.ipdb.interface.InterfacesDict.__getattribute__',
31
+    @mock.patch('pyroute2.ipdb.interfaces.InterfacesDict.__getattribute__',
32 32
                 return_value=mock_create)
33
-    @mock.patch('pyroute2.ipdb.interface.InterfacesDict.__getitem__',
33
+    @mock.patch('pyroute2.ipdb.interfaces.InterfacesDict.__getitem__',
34 34
                 return_value=mock_interface)
35 35
     def test_port_bind(self, mock_getitem, mock_getattribute,
36 36
                        mock_configure_container_iface):

+ 2
- 2
kuryr/tests/unit/binding/drivers/test_macvlan.py View File

@@ -28,9 +28,9 @@ class TestMacvlanDriver(base.TestCase):
28 28
     """Unit tests for nested MACVLAN driver"""
29 29
 
30 30
     @mock.patch('kuryr.lib.binding.drivers.utils._configure_container_iface')
31
-    @mock.patch('pyroute2.ipdb.interface.InterfacesDict.__getattribute__',
31
+    @mock.patch('pyroute2.ipdb.interfaces.InterfacesDict.__getattribute__',
32 32
                 return_value=mock_create)
33
-    @mock.patch('pyroute2.ipdb.interface.InterfacesDict.__getitem__',
33
+    @mock.patch('pyroute2.ipdb.interfaces.InterfacesDict.__getitem__',
34 34
                 return_value=mock_interface)
35 35
     def test_port_bind(self, mock_getitem, mock_getattribute,
36 36
                        mock_configure_container_iface):

+ 2
- 2
kuryr/tests/unit/binding/drivers/test_utils.py View File

@@ -13,7 +13,7 @@ import ddt
13 13
 import mock
14 14
 from oslo_utils import uuidutils
15 15
 
16
-import pyroute2.ipdb.interface
16
+import pyroute2.ipdb.interfaces
17 17
 from pyroute2.netlink.rtnl import ifinfmsg
18 18
 
19 19
 from kuryr.lib.binding.drivers import utils
@@ -104,7 +104,7 @@ class BindingDriversUtilsTest(base.TestCase):
104 104
             'tenant_id': '51b66b97a12f42a990452967d2c555ac',
105 105
             'updated_at': '2016-09-27T08:57:13'}]
106 106
 
107
-        fake_iface = mock.Mock(spec=pyroute2.ipdb.interface.Interface)
107
+        fake_iface = mock.Mock(spec=pyroute2.ipdb.interfaces.Interface)
108 108
         _set_mtu = mock.Mock()
109 109
         _set_address = mock.Mock()
110 110
         fake_iface.attach_mock(_set_mtu, 'set_mtu')

+ 2
- 2
kuryr/tests/unit/binding/drivers/test_veth.py View File

@@ -30,9 +30,9 @@ class TestVethDriver(base.TestCase):
30 30
     @mock.patch('os.path.exists', return_value=True)
31 31
     @mock.patch('oslo_concurrency.processutils.execute',
32 32
                 return_value=('fake_stdout', 'fake_stderr'))
33
-    @mock.patch('pyroute2.ipdb.interface.InterfacesDict.__getattribute__',
33
+    @mock.patch('pyroute2.ipdb.interfaces.InterfacesDict.__getattribute__',
34 34
                 return_value=mock_create)
35
-    @mock.patch('pyroute2.ipdb.interface.InterfacesDict.__getitem__',
35
+    @mock.patch('pyroute2.ipdb.interfaces.InterfacesDict.__getitem__',
36 36
                 return_value=mock_interface)
37 37
     def test_port_bind(self, mock_getitem, mock_getattribute,
38 38
                        mock_execute, mock_path_exists):

+ 2
- 2
kuryr/tests/unit/binding/drivers/test_vlan.py View File

@@ -28,9 +28,9 @@ class TestVlanDriver(base.TestCase):
28 28
     """Unit tests for nested vlan driver"""
29 29
 
30 30
     @mock.patch('kuryr.lib.binding.drivers.utils._configure_container_iface')
31
-    @mock.patch('pyroute2.ipdb.interface.InterfacesDict.__getattribute__',
31
+    @mock.patch('pyroute2.ipdb.interfaces.InterfacesDict.__getattribute__',
32 32
                 return_value=mock_create)
33
-    @mock.patch('pyroute2.ipdb.interface.InterfacesDict.__getitem__',
33
+    @mock.patch('pyroute2.ipdb.interfaces.InterfacesDict.__getitem__',
34 34
                 return_value=mock_interface)
35 35
     def test_port_bind(self, mock_getitem, mock_getattribute,
36 36
                        mock_configure_container_iface):

+ 1
- 1
requirements.txt View File

@@ -11,6 +11,6 @@ oslo.i18n>=2.1.0 # Apache-2.0
11 11
 oslo.log>=3.22.0 # Apache-2.0
12 12
 oslo.utils>=3.20.0 # Apache-2.0
13 13
 pbr!=2.1.0,>=2.0.0 # Apache-2.0
14
-pyroute2>=0.4.12 # Apache-2.0 (+ dual licensed GPL2)
14
+pyroute2>=0.4.15 # Apache-2.0 (+ dual licensed GPL2)
15 15
 python-neutronclient>=5.1.0 # Apache-2.0
16 16
 six>=1.9.0 # MIT

Loading…
Cancel
Save