os-vif 3.7.0__py3-none-any.whl → 4.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of os-vif might be problematic. Click here for more details.
- os_vif/internal/ip/api.py +2 -13
- os_vif/tests/unit/internal/ip/test_api.py +3 -21
- os_vif/tests/unit/test_os_vif.py +14 -8
- {os_vif-3.7.0.dist-info → os_vif-4.1.0.dist-info}/AUTHORS +2 -0
- {os_vif-3.7.0.dist-info → os_vif-4.1.0.dist-info}/METADATA +19 -21
- {os_vif-3.7.0.dist-info → os_vif-4.1.0.dist-info}/RECORD +21 -25
- {os_vif-3.7.0.dist-info → os_vif-4.1.0.dist-info}/WHEEL +1 -1
- {os_vif-3.7.0.dist-info → os_vif-4.1.0.dist-info}/entry_points.txt +0 -1
- os_vif-4.1.0.dist-info/pbr.json +1 -0
- vif_plug_linux_bridge/linux_bridge.py +9 -0
- vif_plug_ovs/constants.py +0 -3
- vif_plug_ovs/linux_net.py +1 -8
- vif_plug_ovs/ovs.py +9 -40
- vif_plug_ovs/ovsdb/ovsdb_lib.py +7 -8
- vif_plug_ovs/tests/functional/base.py +8 -1
- vif_plug_ovs/tests/functional/ovsdb/test_ovsdb_lib.py +5 -0
- vif_plug_ovs/tests/functional/test_plugin.py +35 -0
- vif_plug_ovs/tests/unit/ovsdb/test_ovsdb_lib.py +1 -11
- vif_plug_ovs/tests/unit/test_plugin.py +10 -64
- os_vif/internal/ip/windows/__init__.py +0 -0
- os_vif/internal/ip/windows/impl_netifaces.py +0 -47
- os_vif/tests/unit/internal/ip/windows/__init__.py +0 -0
- os_vif/tests/unit/internal/ip/windows/test_impl_netifaces.py +0 -46
- os_vif-3.7.0.dist-info/pbr.json +0 -1
- {os_vif-3.7.0.dist-info → os_vif-4.1.0.dist-info}/LICENSE +0 -0
- {os_vif-3.7.0.dist-info → os_vif-4.1.0.dist-info}/top_level.txt +0 -0
os_vif/internal/ip/api.py
CHANGED
|
@@ -10,21 +10,10 @@
|
|
|
10
10
|
# License for the specific language governing permissions and limitations
|
|
11
11
|
# under the License.
|
|
12
12
|
|
|
13
|
-
import os
|
|
14
|
-
import warnings
|
|
15
|
-
|
|
16
13
|
from oslo_log import log as logging
|
|
17
14
|
|
|
18
|
-
|
|
19
|
-
warnings.warn('Support for Windows OS is deprecated.',
|
|
20
|
-
category=DeprecationWarning)
|
|
21
|
-
from os_vif.internal.ip.windows.impl_netifaces import \
|
|
22
|
-
Netifaces as ip_lib_class
|
|
23
|
-
else:
|
|
24
|
-
from os_vif.internal.ip.linux.impl_pyroute2 import \
|
|
25
|
-
PyRoute2 as ip_lib_class
|
|
26
|
-
|
|
15
|
+
from os_vif.internal.ip.linux.impl_pyroute2 import PyRoute2
|
|
27
16
|
|
|
28
17
|
LOG = logging.getLogger(__name__)
|
|
29
18
|
|
|
30
|
-
ip =
|
|
19
|
+
ip = PyRoute2()
|
|
@@ -10,30 +10,12 @@
|
|
|
10
10
|
# License for the specific language governing permissions and limitations
|
|
11
11
|
# under the License.
|
|
12
12
|
|
|
13
|
-
import importlib
|
|
14
|
-
|
|
15
|
-
from unittest import mock
|
|
16
|
-
|
|
17
13
|
from os_vif.internal.ip import api
|
|
14
|
+
from os_vif.internal.ip.linux import impl_pyroute2
|
|
18
15
|
from os_vif.tests.unit import base
|
|
19
16
|
|
|
20
17
|
|
|
21
18
|
class TestIpApi(base.TestCase):
|
|
22
19
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
importlib.reload(api)
|
|
26
|
-
|
|
27
|
-
def test_get_impl_windows(self):
|
|
28
|
-
self.addCleanup(self._reload_original_os_module)
|
|
29
|
-
with mock.patch('os.name', 'nt'):
|
|
30
|
-
importlib.reload(api)
|
|
31
|
-
from os_vif.internal.ip.windows import impl_netifaces
|
|
32
|
-
self.assertIsInstance(api.ip, impl_netifaces.Netifaces)
|
|
33
|
-
|
|
34
|
-
def test_get_impl_linux(self):
|
|
35
|
-
self.addCleanup(self._reload_original_os_module)
|
|
36
|
-
with mock.patch('os.name', 'posix'):
|
|
37
|
-
importlib.reload(api)
|
|
38
|
-
from os_vif.internal.ip.linux import impl_pyroute2
|
|
39
|
-
self.assertIsInstance(api.ip, impl_pyroute2.PyRoute2)
|
|
20
|
+
def test_get_impl(self):
|
|
21
|
+
self.assertIsInstance(api.ip, impl_pyroute2.PyRoute2)
|
os_vif/tests/unit/test_os_vif.py
CHANGED
|
@@ -105,10 +105,13 @@ class TestOSVIF(base.TestCase):
|
|
|
105
105
|
entry_point="os-vif",
|
|
106
106
|
plugin=DemoPlugin,
|
|
107
107
|
obj=None)
|
|
108
|
-
with mock.patch(
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
108
|
+
with mock.patch(
|
|
109
|
+
'stevedore.extension.ExtensionManager.names',
|
|
110
|
+
return_value=['foobar'],
|
|
111
|
+
), mock.patch(
|
|
112
|
+
'stevedore.extension.ExtensionManager.__getitem__',
|
|
113
|
+
return_value=plg,
|
|
114
|
+
):
|
|
112
115
|
os_vif.initialize()
|
|
113
116
|
info = objects.instance_info.InstanceInfo()
|
|
114
117
|
vif = objects.vif.VIFBridge(
|
|
@@ -123,10 +126,13 @@ class TestOSVIF(base.TestCase):
|
|
|
123
126
|
entry_point="os-vif",
|
|
124
127
|
plugin=DemoPlugin,
|
|
125
128
|
obj=None)
|
|
126
|
-
with mock.patch(
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
129
|
+
with mock.patch(
|
|
130
|
+
'stevedore.extension.ExtensionManager.names',
|
|
131
|
+
return_value=['foobar']
|
|
132
|
+
), mock.patch(
|
|
133
|
+
'stevedore.extension.ExtensionManager.__getitem__',
|
|
134
|
+
return_value=plg,
|
|
135
|
+
):
|
|
130
136
|
os_vif.initialize()
|
|
131
137
|
info = objects.instance_info.InstanceInfo()
|
|
132
138
|
vif = objects.vif.VIFBridge(
|
|
@@ -2,6 +2,7 @@ Adrian Chiris <adrianc@mellanox.com>
|
|
|
2
2
|
Alin Balutoiu <abalutoiu@cloudbasesolutions.com>
|
|
3
3
|
Andreas Jaeger <aj@suse.com>
|
|
4
4
|
Balazs Gibizer <gibi@redhat.com>
|
|
5
|
+
Bence Romsics <bence.romsics@gmail.com>
|
|
5
6
|
Brian Haley <brian.haley@hpe.com>
|
|
6
7
|
Cao Xuan Hoang <hoangcx@vn.fujitsu.com>
|
|
7
8
|
Carlos Goncalves <cgoncalves@redhat.com>
|
|
@@ -47,6 +48,7 @@ Sahid Orentino Ferdjaoui <sahid.ferdjaoui@redhat.com>
|
|
|
47
48
|
Sean Dague <sean@dague.net>
|
|
48
49
|
Sean M. Collins <sean@coreitpro.com>
|
|
49
50
|
Sean Mooney <sean.k.mooney@intel.com>
|
|
51
|
+
Sean Mooney <sean@seanmooney.info>
|
|
50
52
|
Sean Mooney <work@seanmooney.info>
|
|
51
53
|
Sergey Belous <sbelous@mirantis.com>
|
|
52
54
|
Spencer Yu <yushb@gohighsec.com>
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
|
-
Name:
|
|
3
|
-
Version:
|
|
2
|
+
Name: os_vif
|
|
3
|
+
Version: 4.1.0
|
|
4
4
|
Summary: A library for plugging and unplugging virtual interfaces in OpenStack.
|
|
5
5
|
Home-page: https://docs.openstack.org/os-vif/latest/
|
|
6
6
|
Author: OpenStack
|
|
7
7
|
Author-email: openstack-discuss@lists.openstack.org
|
|
8
|
-
License: UNKNOWN
|
|
9
|
-
Platform: UNKNOWN
|
|
10
8
|
Classifier: Environment :: OpenStack
|
|
11
9
|
Classifier: Intended Audience :: Information Technology
|
|
12
10
|
Classifier: Intended Audience :: System Administrators
|
|
@@ -15,25 +13,27 @@ Classifier: Operating System :: POSIX :: Linux
|
|
|
15
13
|
Classifier: Programming Language :: Python
|
|
16
14
|
Classifier: Programming Language :: Python :: 3
|
|
17
15
|
Classifier: Programming Language :: Python :: 3 :: Only
|
|
18
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
19
16
|
Classifier: Programming Language :: Python :: 3.9
|
|
20
17
|
Classifier: Programming Language :: Python :: 3.10
|
|
21
18
|
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
22
20
|
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
23
|
-
Requires-Python: >=3.
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
Requires-Dist:
|
|
27
|
-
Requires-Dist: oslo.
|
|
28
|
-
Requires-Dist: oslo.
|
|
29
|
-
Requires-Dist: oslo.
|
|
30
|
-
Requires-Dist: oslo.
|
|
31
|
-
Requires-Dist: oslo.
|
|
32
|
-
Requires-Dist: oslo.
|
|
33
|
-
Requires-Dist:
|
|
34
|
-
Requires-Dist:
|
|
35
|
-
Requires-Dist:
|
|
36
|
-
Requires-Dist:
|
|
21
|
+
Requires-Python: >=3.9
|
|
22
|
+
License-File: LICENSE
|
|
23
|
+
License-File: AUTHORS
|
|
24
|
+
Requires-Dist: pbr >=3.0.0
|
|
25
|
+
Requires-Dist: oslo.concurrency >=3.20.0
|
|
26
|
+
Requires-Dist: oslo.config >=5.1.0
|
|
27
|
+
Requires-Dist: oslo.log >=3.30.0
|
|
28
|
+
Requires-Dist: oslo.i18n >=3.15.3
|
|
29
|
+
Requires-Dist: oslo.privsep >=1.23.0
|
|
30
|
+
Requires-Dist: oslo.serialization >=2.20.0
|
|
31
|
+
Requires-Dist: oslo.utils >=2.0.0
|
|
32
|
+
Requires-Dist: oslo.versionedobjects >=1.28.0
|
|
33
|
+
Requires-Dist: ovsdbapp >=0.12.1
|
|
34
|
+
Requires-Dist: stevedore >=1.20.0
|
|
35
|
+
Requires-Dist: debtcollector >=1.19.0
|
|
36
|
+
Requires-Dist: pyroute2 >=0.5.2 ; (sys_platform!='win32')
|
|
37
37
|
|
|
38
38
|
========================
|
|
39
39
|
Team and repository tags
|
|
@@ -64,5 +64,3 @@ A library for plugging and unplugging virtual interfaces in OpenStack.
|
|
|
64
64
|
* Bugs: https://bugs.launchpad.net/os-vif
|
|
65
65
|
* Release Notes: https://docs.openstack.org/releasenotes/os-vif
|
|
66
66
|
|
|
67
|
-
|
|
68
|
-
|
|
@@ -7,12 +7,10 @@ os_vif/utils.py,sha256=bmJRam0laHAVLIHpQufzLASu_VTEqsGTuJYmoYfqOco,713
|
|
|
7
7
|
os_vif/version.py,sha256=ilQe2xTxPDxlzJYWbq8KdHeashflTfC1OZewgFPKPRI,713
|
|
8
8
|
os_vif/internal/__init__.py,sha256=VGE1e9o-7RkuTzNhZl4Wivz1tojriLYypVBObhSZfSk,967
|
|
9
9
|
os_vif/internal/ip/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
10
|
-
os_vif/internal/ip/api.py,sha256=
|
|
10
|
+
os_vif/internal/ip/api.py,sha256=BlGJdRe_Yn7P23Dejo7gLK-M6UasY8sKrMCz0FPvx2s,722
|
|
11
11
|
os_vif/internal/ip/ip_command.py,sha256=agySNBD4GHp87uo6HbtIg4JwtOMhfuRZN5X7ytPir5k,2787
|
|
12
12
|
os_vif/internal/ip/linux/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
13
13
|
os_vif/internal/ip/linux/impl_pyroute2.py,sha256=ddQ9d7fzBJEYmE1wJhMfpmHftTBFdJ2C94dCNGRsB0A,5511
|
|
14
|
-
os_vif/internal/ip/windows/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
15
|
-
os_vif/internal/ip/windows/impl_netifaces.py,sha256=hPgC7KaymxdD4XrYw5G5IkXiKjth-tc9Gc1_pzcsyuo,1745
|
|
16
14
|
os_vif/objects/__init__.py,sha256=ePMVrOlb8ti6YmpdZ15pOXI1XLeFjHvhBvw35abZRZE,883
|
|
17
15
|
os_vif/objects/base.py,sha256=kI0c1gPDN37RhGuOYg18AA7l98uUfpqs14AS9GfE4oE,1139
|
|
18
16
|
os_vif/objects/fields.py,sha256=i_kVqeCOBfcNKuZiB3gBat-8qJWhLtwEQxsl-k5plgw,1761
|
|
@@ -37,19 +35,17 @@ os_vif/tests/unit/test_base.py,sha256=iqgweFRWprY98mkGL3HIbV9D8DuX_tUPH8uRiDflwD
|
|
|
37
35
|
os_vif/tests/unit/test_exception.py,sha256=UDVJSR3CKU3rc5kmN14ilL9Fj0cgnwQbGoP4weo2P4w,1335
|
|
38
36
|
os_vif/tests/unit/test_host_info.py,sha256=2PYHg4pY-YwUuSg9MyDKJbJhKVGRT6ujJATkzzIPx18,7576
|
|
39
37
|
os_vif/tests/unit/test_objects.py,sha256=WflvhMvvCauXexj04tCw47HvsysHX4Q7fsgJKrPNaI8,3709
|
|
40
|
-
os_vif/tests/unit/test_os_vif.py,sha256=
|
|
38
|
+
os_vif/tests/unit/test_os_vif.py,sha256=b0h65Wa9tvxw-e7c707SoJQjfGzEALSFZUPkTtr_GkY,6612
|
|
41
39
|
os_vif/tests/unit/test_vif.py,sha256=mhg2PZ3iVEPzffO5I0VT1wIUP3c-h7MAqrZgCuZdjxE,18000
|
|
42
40
|
os_vif/tests/unit/internal/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
43
41
|
os_vif/tests/unit/internal/ip/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
44
|
-
os_vif/tests/unit/internal/ip/test_api.py,sha256=
|
|
42
|
+
os_vif/tests/unit/internal/ip/test_api.py,sha256=LnkAM0M8giNjAw_Q4-oRic3WIW3OWq-SCGlde9SCenY,820
|
|
45
43
|
os_vif/tests/unit/internal/ip/linux/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
46
44
|
os_vif/tests/unit/internal/ip/linux/test_impl_pyroute2.py,sha256=MbsDkFkVSmx3mqteP7GW3ruy6ehvBCiQorkdWJjE5Qk,7364
|
|
47
|
-
os_vif/tests/unit/internal/ip/windows/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
48
|
-
os_vif/tests/unit/internal/ip/windows/test_impl_netifaces.py,sha256=fs1DI706OXTWGr4C8_UtbBEvxwImv3klrxmuktUYol8,1992
|
|
49
45
|
vif_plug_linux_bridge/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
50
46
|
vif_plug_linux_bridge/constants.py,sha256=NC8n4uOMFCYrhq0sM1ZeGBKo-Gs4OMR60cYP47wMRCk,602
|
|
51
47
|
vif_plug_linux_bridge/iptables.py,sha256=q4LmAMMzg-r9IgDNTu3jCLjNDM8b0JbGo-qmiA2B-JE,20641
|
|
52
|
-
vif_plug_linux_bridge/linux_bridge.py,sha256=
|
|
48
|
+
vif_plug_linux_bridge/linux_bridge.py,sha256=oNf-HuLuaixlOyAL2CgZeZ3OHSknUh-zMhmPDI6XOBc,5345
|
|
53
49
|
vif_plug_linux_bridge/linux_net.py,sha256=0SuMKqMSNHRnSMs3XNVjBF0MPzhUuQIti159QkL8k1U,9481
|
|
54
50
|
vif_plug_linux_bridge/privsep.py,sha256=dHAVOrY7kC3hrfDy7OAyt17XG2TpZHwgMr0Pmgx1XYM,884
|
|
55
51
|
vif_plug_linux_bridge/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -62,32 +58,32 @@ vif_plug_noop/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSu
|
|
|
62
58
|
vif_plug_noop/tests/unit/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
63
59
|
vif_plug_noop/tests/unit/test_plugin.py,sha256=x8m9zuGtHsPoZRZP6Q6BREAFx0wiEagFtTFlB_i_Bxc,1236
|
|
64
60
|
vif_plug_ovs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
65
|
-
vif_plug_ovs/constants.py,sha256=
|
|
61
|
+
vif_plug_ovs/constants.py,sha256=vQKnYSeBMjV2RGQPGxk96D8FtgpvJIZEX_yZzUlsGg8,892
|
|
66
62
|
vif_plug_ovs/exception.py,sha256=ZiECZVvjCFTVXhuii3uhJn4lZvozKRxziedZB3R9JNo,1328
|
|
67
|
-
vif_plug_ovs/linux_net.py,sha256=
|
|
68
|
-
vif_plug_ovs/ovs.py,sha256=
|
|
63
|
+
vif_plug_ovs/linux_net.py,sha256=HvhfSXjeAlU2l9iZNiN8CFr-GL9psS8Hk8_KAaktH6I,13922
|
|
64
|
+
vif_plug_ovs/ovs.py,sha256=tN-JxK7VoIAdlradnk6kKCChenu_LLQWMKjJ_u834QY,22946
|
|
69
65
|
vif_plug_ovs/privsep.py,sha256=nPQUkYgjbSjaHMuu40fZArRnf8RBiR73l4YpDF1K1yQ,1100
|
|
70
66
|
vif_plug_ovs/ovsdb/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
71
67
|
vif_plug_ovs/ovsdb/api.py,sha256=_jHR8xokDAPI8sw3IEWuT3hObJuskqVzeVMDaWRbIq0,1293
|
|
72
68
|
vif_plug_ovs/ovsdb/impl_idl.py,sha256=DR1aHN8riBpZyNePwpvT9PRYbf9vLk4lRJ9VHRVq_to,3028
|
|
73
69
|
vif_plug_ovs/ovsdb/impl_vsctl.py,sha256=MSf8JMrMqrwt5vH8KTsThjdnsttJEYJikIcJ12CTz8c,14437
|
|
74
|
-
vif_plug_ovs/ovsdb/ovsdb_lib.py,sha256=
|
|
70
|
+
vif_plug_ovs/ovsdb/ovsdb_lib.py,sha256=SJuEnl26wGOLzEXNdgVhrKue2FTPgCpLiVLNak34Buw,10505
|
|
75
71
|
vif_plug_ovs/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
76
72
|
vif_plug_ovs/tests/functional/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
77
|
-
vif_plug_ovs/tests/functional/base.py,sha256=
|
|
78
|
-
vif_plug_ovs/tests/functional/test_plugin.py,sha256=
|
|
73
|
+
vif_plug_ovs/tests/functional/base.py,sha256=GZKyA9UR9BaEgZ0tv6xyMTQnz9FpKedV2do1ePMB-rw,2059
|
|
74
|
+
vif_plug_ovs/tests/functional/test_plugin.py,sha256=JzRiEIUonC4STcV9GWiwyaJybgOVxMSHyLmqACBf8Ck,8264
|
|
79
75
|
vif_plug_ovs/tests/functional/ovsdb/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
80
|
-
vif_plug_ovs/tests/functional/ovsdb/test_ovsdb_lib.py,sha256=
|
|
76
|
+
vif_plug_ovs/tests/functional/ovsdb/test_ovsdb_lib.py,sha256=tXSTmjYWOmqLXYQ42_3Sv8XNNktlDxPDalJRr8KRwCU,13775
|
|
81
77
|
vif_plug_ovs/tests/unit/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
82
78
|
vif_plug_ovs/tests/unit/test_linux_net.py,sha256=B3buNpn9EKZQPio5rNrIma_E5MUL9vBspdg5EqZ3RHk,17532
|
|
83
|
-
vif_plug_ovs/tests/unit/test_plugin.py,sha256
|
|
79
|
+
vif_plug_ovs/tests/unit/test_plugin.py,sha256=YfJXJirOWbZB2l2VHTiJPCMZlgBCyRXDAFgzEj6pQeY,30827
|
|
84
80
|
vif_plug_ovs/tests/unit/ovsdb/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
85
|
-
vif_plug_ovs/tests/unit/ovsdb/test_ovsdb_lib.py,sha256
|
|
86
|
-
os_vif-
|
|
87
|
-
os_vif-
|
|
88
|
-
os_vif-
|
|
89
|
-
os_vif-
|
|
90
|
-
os_vif-
|
|
91
|
-
os_vif-
|
|
92
|
-
os_vif-
|
|
93
|
-
os_vif-
|
|
81
|
+
vif_plug_ovs/tests/unit/ovsdb/test_ovsdb_lib.py,sha256=-Z50UgEgg2awEgPb_r_iqQBsyYTKlSadi3S9laGFfjg,10270
|
|
82
|
+
os_vif-4.1.0.dist-info/AUTHORS,sha256=Jl9BVjDjzq5vO3_b0rnuUWx-P4wsTnfH8iLVMFZrUH8,3290
|
|
83
|
+
os_vif-4.1.0.dist-info/LICENSE,sha256=XfKg2H1sVi8OoRxoisUlMqoo10TKvHmU_wU39ks7MyA,10143
|
|
84
|
+
os_vif-4.1.0.dist-info/METADATA,sha256=rDAbv57FXl1MAJQmQsJsLw5cK6bAEOHMwVCtVxEfOfI,2338
|
|
85
|
+
os_vif-4.1.0.dist-info/WHEEL,sha256=P9jw-gEje8ByB7_hXoICnHtVCrEwMQh-630tKvQWehc,91
|
|
86
|
+
os_vif-4.1.0.dist-info/entry_points.txt,sha256=BU9WplZnF_bjwT4SQP5n1mKu2f0R5xXBOznXP1GygHM,206
|
|
87
|
+
os_vif-4.1.0.dist-info/pbr.json,sha256=Yy5hVFB_dwDLDjOBUX039V8KA8i0TiV456Q_kkEfqDM,46
|
|
88
|
+
os_vif-4.1.0.dist-info/top_level.txt,sha256=ULBxtkTk3bkfzCSYJjifWehfjJdMODVzC6SX5l_CNKo,56
|
|
89
|
+
os_vif-4.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"git_version": "acdd974", "is_release": true}
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
# License for the specific language governing permissions and limitations
|
|
18
18
|
# under the License.
|
|
19
19
|
|
|
20
|
+
import debtcollector.removals
|
|
20
21
|
from os_vif import objects
|
|
21
22
|
from os_vif import plugin
|
|
22
23
|
from oslo_config import cfg
|
|
@@ -94,6 +95,10 @@ class LinuxBridgePlugin(plugin.PluginBase):
|
|
|
94
95
|
supported_port_profiles=[]),
|
|
95
96
|
])
|
|
96
97
|
|
|
98
|
+
@debtcollector.removals.remove(
|
|
99
|
+
message="LinuxBridgePlugin is deprecated and will be removed in "
|
|
100
|
+
"a future release",
|
|
101
|
+
category=DeprecationWarning)
|
|
97
102
|
def plug(self, vif, instance_info):
|
|
98
103
|
"""Ensure that the bridge exists, and add VIF to it."""
|
|
99
104
|
network = vif.network
|
|
@@ -111,6 +116,10 @@ class LinuxBridgePlugin(plugin.PluginBase):
|
|
|
111
116
|
linux_net.ensure_bridge(bridge_name, iface,
|
|
112
117
|
filtering=install_filters, mtu=mtu)
|
|
113
118
|
|
|
119
|
+
@debtcollector.removals.remove(
|
|
120
|
+
message="LinuxBridgePlugin is deprecated and will be removed in "
|
|
121
|
+
"a future release",
|
|
122
|
+
category=DeprecationWarning)
|
|
114
123
|
def unplug(self, vif, instance_info):
|
|
115
124
|
# Nothing required to unplug a port for a VIF using standard
|
|
116
125
|
# Linux bridge device...
|
vif_plug_ovs/constants.py
CHANGED
vif_plug_ovs/linux_net.py
CHANGED
|
@@ -22,14 +22,12 @@
|
|
|
22
22
|
import glob
|
|
23
23
|
import os
|
|
24
24
|
import re
|
|
25
|
-
import sys
|
|
26
25
|
|
|
27
26
|
from os_vif.internal.ip.api import ip as ip_lib
|
|
28
27
|
from oslo_concurrency import processutils
|
|
29
28
|
from oslo_log import log as logging
|
|
30
29
|
from oslo_utils import excutils
|
|
31
30
|
|
|
32
|
-
from vif_plug_ovs import constants
|
|
33
31
|
from vif_plug_ovs import exception
|
|
34
32
|
from vif_plug_ovs import privsep
|
|
35
33
|
|
|
@@ -55,12 +53,7 @@ NIC_NAME_LEN = 14
|
|
|
55
53
|
def _update_device_mtu(dev, mtu):
|
|
56
54
|
if not mtu:
|
|
57
55
|
return
|
|
58
|
-
|
|
59
|
-
# Hyper-V with OVS does not support external programming of
|
|
60
|
-
# virtual interface MTUs via netsh or other Windows tools.
|
|
61
|
-
# When plugging an interface on Windows, we therefore skip
|
|
62
|
-
# programming the MTU and fallback to DHCP advertisement.
|
|
63
|
-
set_device_mtu(dev, mtu)
|
|
56
|
+
set_device_mtu(dev, mtu)
|
|
64
57
|
|
|
65
58
|
|
|
66
59
|
@privsep.vif_plug.entrypoint
|
vif_plug_ovs/ovs.py
CHANGED
|
@@ -17,8 +17,6 @@
|
|
|
17
17
|
# License for the specific language governing permissions and limitations
|
|
18
18
|
# under the License.
|
|
19
19
|
|
|
20
|
-
import sys
|
|
21
|
-
|
|
22
20
|
from oslo_config import cfg
|
|
23
21
|
from oslo_log import log as logging
|
|
24
22
|
|
|
@@ -27,7 +25,6 @@ from os_vif.internal.ip.api import ip as ip_lib
|
|
|
27
25
|
from os_vif import objects
|
|
28
26
|
from os_vif import plugin
|
|
29
27
|
|
|
30
|
-
|
|
31
28
|
from vif_plug_ovs import constants
|
|
32
29
|
from vif_plug_ovs import exception
|
|
33
30
|
from vif_plug_ovs import linux_net
|
|
@@ -181,9 +178,6 @@ class OvsPlugin(plugin.PluginBase):
|
|
|
181
178
|
def supports_tc_qdisc(self, vif) -> bool:
|
|
182
179
|
if self._get_vif_datapath_type(vif) != constants.OVS_DATAPATH_SYSTEM:
|
|
183
180
|
return False
|
|
184
|
-
if sys.platform == constants.PLATFORM_WIN32:
|
|
185
|
-
return False
|
|
186
|
-
|
|
187
181
|
return True
|
|
188
182
|
|
|
189
183
|
def _isolate_vif(self, vif_name, bridge):
|
|
@@ -208,8 +202,12 @@ class OvsPlugin(plugin.PluginBase):
|
|
|
208
202
|
# bound the interface in the vif binding details so isolation
|
|
209
203
|
# can be enabled automatically in the future.
|
|
210
204
|
bridge = kwargs.pop('bridge', vif.network.bridge)
|
|
211
|
-
|
|
205
|
+
# See bug #2069543.
|
|
206
|
+
if (self._isolate_vif(vif_name, bridge) and
|
|
207
|
+
not self._is_trunk_bridge(bridge)):
|
|
212
208
|
kwargs['tag'] = constants.DEAD_VLAN
|
|
209
|
+
kwargs['vlan_mode'] = 'trunk'
|
|
210
|
+
kwargs['trunks'] = constants.DEAD_VLAN
|
|
213
211
|
qos_type = self._get_qos_type(vif)
|
|
214
212
|
if qos_type is not None:
|
|
215
213
|
# NOTE(sean-k-mooney): If the port is not already created
|
|
@@ -283,14 +281,6 @@ class OvsPlugin(plugin.PluginBase):
|
|
|
283
281
|
linux_net.update_veth_pair(v1_name, v2_name, mtu)
|
|
284
282
|
self._update_vif_port(vif, v2_name)
|
|
285
283
|
|
|
286
|
-
def _plug_vif_windows(self, vif, instance_info):
|
|
287
|
-
"""Create a per-VIF OVS port."""
|
|
288
|
-
|
|
289
|
-
if not ip_lib.exists(vif.id):
|
|
290
|
-
self.ovsdb.ensure_ovs_bridge(vif.network.bridge,
|
|
291
|
-
self._get_vif_datapath_type(vif))
|
|
292
|
-
self._create_vif_port(vif, vif.id, instance_info)
|
|
293
|
-
|
|
294
284
|
def _plug_port_bridge(self, vif, instance_info):
|
|
295
285
|
"""Create a per-VIF OVS bridge and patch pair."""
|
|
296
286
|
|
|
@@ -317,8 +307,8 @@ class OvsPlugin(plugin.PluginBase):
|
|
|
317
307
|
instance_id = instance_info.uuid
|
|
318
308
|
LOG.debug(
|
|
319
309
|
'creating patch port pair \n'
|
|
320
|
-
f'{port_bridge_name}:({port_bridge_patch}) -> '
|
|
321
|
-
f'{int_bridge_name}:({int_bridge_patch})'
|
|
310
|
+
f'{port_bridge_name}: ({port_bridge_patch}) -> '
|
|
311
|
+
f'{int_bridge_name}: ({int_bridge_patch})'
|
|
322
312
|
)
|
|
323
313
|
self.ovsdb.create_patch_port_pair(
|
|
324
314
|
port_bridge_name, port_bridge_patch, int_bridge_name,
|
|
@@ -381,15 +371,7 @@ class OvsPlugin(plugin.PluginBase):
|
|
|
381
371
|
raise exception.WrongPortProfile(
|
|
382
372
|
profile=vif.port_profile.__class__.__name__)
|
|
383
373
|
|
|
384
|
-
if
|
|
385
|
-
if type(vif) not in (
|
|
386
|
-
objects.vif.VIFOpenVSwitch, objects.vif.VIFBridge
|
|
387
|
-
):
|
|
388
|
-
raise osv_exception.PlugException(
|
|
389
|
-
vif=vif, err="This vif type is not supported on Windows")
|
|
390
|
-
|
|
391
|
-
self._plug_vif_windows(vif, instance_info)
|
|
392
|
-
elif isinstance(vif, objects.vif.VIFOpenVSwitch):
|
|
374
|
+
if isinstance(vif, objects.vif.VIFOpenVSwitch):
|
|
393
375
|
if self.config.per_port_bridge:
|
|
394
376
|
self._plug_port_bridge(vif, instance_info)
|
|
395
377
|
else:
|
|
@@ -443,12 +425,6 @@ class OvsPlugin(plugin.PluginBase):
|
|
|
443
425
|
qos_type = self.config.default_qos_type
|
|
444
426
|
return qos_type
|
|
445
427
|
|
|
446
|
-
def _unplug_vif_windows(self, vif, instance_info):
|
|
447
|
-
"""Remove port from OVS."""
|
|
448
|
-
self.ovsdb.delete_ovs_vif_port(vif.network.bridge, vif.id,
|
|
449
|
-
delete_netdev=False)
|
|
450
|
-
self._delete_bridge_if_trunk(vif)
|
|
451
|
-
|
|
452
428
|
def _unplug_port_bridge(self, vif, instance_info):
|
|
453
429
|
"""Create a per-VIF OVS bridge and patch pair."""
|
|
454
430
|
# NOTE(sean-k-mooney): the port name prefix should not be
|
|
@@ -508,14 +484,7 @@ class OvsPlugin(plugin.PluginBase):
|
|
|
508
484
|
objects.vif.VIFPortProfileOpenVSwitch):
|
|
509
485
|
raise exception.WrongPortProfile(
|
|
510
486
|
profile=vif.port_profile.__class__.__name__)
|
|
511
|
-
if
|
|
512
|
-
if type(vif) not in (
|
|
513
|
-
objects.vif.VIFOpenVSwitch, objects.vif.VIFBridge
|
|
514
|
-
):
|
|
515
|
-
raise osv_exception.UnplugException(
|
|
516
|
-
vif=vif, err="This vif type is not supported on windows.")
|
|
517
|
-
self._unplug_vif_windows(vif, instance_info)
|
|
518
|
-
elif isinstance(vif, objects.vif.VIFOpenVSwitch):
|
|
487
|
+
if isinstance(vif, objects.vif.VIFOpenVSwitch):
|
|
519
488
|
if self.config.per_port_bridge:
|
|
520
489
|
self._unplug_port_bridge(vif, instance_info)
|
|
521
490
|
else:
|
vif_plug_ovs/ovsdb/ovsdb_lib.py
CHANGED
|
@@ -10,7 +10,6 @@
|
|
|
10
10
|
# License for the specific language governing permissions and limitations
|
|
11
11
|
# under the License.
|
|
12
12
|
|
|
13
|
-
import sys
|
|
14
13
|
import uuid
|
|
15
14
|
|
|
16
15
|
from oslo_log import log as logging
|
|
@@ -59,12 +58,7 @@ class BaseOVS(object):
|
|
|
59
58
|
if interface_type not in [
|
|
60
59
|
constants.OVS_VHOSTUSER_INTERFACE_TYPE,
|
|
61
60
|
constants.OVS_VHOSTUSER_CLIENT_INTERFACE_TYPE]:
|
|
62
|
-
|
|
63
|
-
# Hyper-V with OVS does not support external programming of
|
|
64
|
-
# virtual interface MTUs via netsh or other Windows tools.
|
|
65
|
-
# When plugging an interface on Windows, we therefore skip
|
|
66
|
-
# programming the MTU and fallback to DHCP advertisement.
|
|
67
|
-
linux_net.set_device_mtu(dev, mtu)
|
|
61
|
+
linux_net.set_device_mtu(dev, mtu)
|
|
68
62
|
elif self._ovs_supports_mtu_requests():
|
|
69
63
|
self._set_mtu_request(txn, dev, mtu)
|
|
70
64
|
else:
|
|
@@ -145,7 +139,7 @@ class BaseOVS(object):
|
|
|
145
139
|
self, bridge, dev, iface_id, mac, instance_id,
|
|
146
140
|
mtu=None, interface_type=None, vhost_server_path=None,
|
|
147
141
|
tag=None, pf_pci=None, vf_num=None, set_ids=True, datapath_type=None,
|
|
148
|
-
qos_type=None
|
|
142
|
+
qos_type=None, vlan_mode=None, trunks=None
|
|
149
143
|
):
|
|
150
144
|
"""Create OVS port
|
|
151
145
|
|
|
@@ -210,6 +204,11 @@ class BaseOVS(object):
|
|
|
210
204
|
txn.add(self.ovsdb.add_port(bridge, dev))
|
|
211
205
|
if tag:
|
|
212
206
|
txn.add(self.ovsdb.db_set('Port', dev, ('tag', tag)))
|
|
207
|
+
if vlan_mode:
|
|
208
|
+
txn.add(self.ovsdb.db_set('Port', dev,
|
|
209
|
+
('vlan_mode', vlan_mode)))
|
|
210
|
+
if trunks:
|
|
211
|
+
txn.add(self.ovsdb.db_set('Port', dev, ('trunks', trunks)))
|
|
213
212
|
if qid:
|
|
214
213
|
txn.add(self.ovsdb.db_set('Port', dev, ('qos', qid)))
|
|
215
214
|
if col_values:
|
|
@@ -9,6 +9,8 @@
|
|
|
9
9
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
10
10
|
# License for the specific language governing permissions and limitations
|
|
11
11
|
# under the License.
|
|
12
|
+
import functools
|
|
13
|
+
import os
|
|
12
14
|
|
|
13
15
|
from os_vif.tests.functional import base as os_vif_base
|
|
14
16
|
|
|
@@ -28,6 +30,10 @@ class VifPlugOvsBaseFunctionalTestCase(os_vif_base.BaseFunctionalTestCase):
|
|
|
28
30
|
def _check_port(self, name, bridge):
|
|
29
31
|
return self.ovs.port_exists(name, bridge)
|
|
30
32
|
|
|
33
|
+
@functools.cache
|
|
34
|
+
def _get_timeout(self):
|
|
35
|
+
return int(os.environ.get('OS_VIF_CHECK_PARAMETER_TIMEOUT', '10'))
|
|
36
|
+
|
|
31
37
|
def _check_parameter(self, table, port, parameter, expected_value):
|
|
32
38
|
def get_value():
|
|
33
39
|
return self._ovsdb.db_get(table, port, parameter).execute()
|
|
@@ -36,7 +42,8 @@ class VifPlugOvsBaseFunctionalTestCase(os_vif_base.BaseFunctionalTestCase):
|
|
|
36
42
|
val = get_value()
|
|
37
43
|
return val == expected_value
|
|
38
44
|
self.assertTrue(
|
|
39
|
-
wait_until_true(
|
|
45
|
+
wait_until_true(
|
|
46
|
+
check_value, timeout=self._get_timeout(), sleep=0.5),
|
|
40
47
|
f"Parameter {parameter} of {table} {port} is {get_value()} "
|
|
41
48
|
f"not {expected_value}"
|
|
42
49
|
)
|
|
@@ -183,6 +183,11 @@ class TestOVSDBLib(testscenarios.WithScenarios,
|
|
|
183
183
|
'Interface', port_bridge_port, 'options', port_opts)
|
|
184
184
|
|
|
185
185
|
def test_create_ovs_vif_port_with_default_qos(self):
|
|
186
|
+
if self.interface == 'native':
|
|
187
|
+
self.skipTest(
|
|
188
|
+
'test_create_ovs_vif_port_with_default_qos is unstable '
|
|
189
|
+
'when run with the native driver, see: '
|
|
190
|
+
'https://bugs.launchpad.net/os-vif/+bug/2087982')
|
|
186
191
|
port_name = 'qos-port-' + self.interface
|
|
187
192
|
iface_id = 'iface_id'
|
|
188
193
|
mac = 'ca:fe:ca:fe:ca:fe'
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
import testscenarios
|
|
14
14
|
import time
|
|
15
|
+
from unittest import mock
|
|
15
16
|
|
|
16
17
|
from oslo_concurrency import processutils
|
|
17
18
|
from oslo_config import cfg
|
|
@@ -183,3 +184,37 @@ class TestOVSPlugin(testscenarios.WithScenarios,
|
|
|
183
184
|
self._check_parameter(
|
|
184
185
|
'QoS', str(qos_uuid), 'type', None
|
|
185
186
|
)
|
|
187
|
+
|
|
188
|
+
def test_plug_br_int_isolate_vif_dead_vlan(self):
|
|
189
|
+
with mock.patch.object(self.plugin.config, 'isolate_vif', True):
|
|
190
|
+
network = objects.network.Network(
|
|
191
|
+
id='5449523c-3a08-11ef-86d6-17149687aa4d',
|
|
192
|
+
bridge='br-5449523c',
|
|
193
|
+
subnets=self.subnets,
|
|
194
|
+
vlan=99)
|
|
195
|
+
vif = objects.vif.VIFOpenVSwitch(
|
|
196
|
+
id='85cb9bc6-3a08-11ef-b2d4-9b7c38edd677',
|
|
197
|
+
address='ca:fe:de:ad:be:ef',
|
|
198
|
+
network=network,
|
|
199
|
+
port_profile=self.profile_ovs_system,
|
|
200
|
+
vif_name="port-85cb9bc6")
|
|
201
|
+
self.plugin.plug(vif, self.instance)
|
|
202
|
+
self.addCleanup(self._del_bridge, 'br-5449523c')
|
|
203
|
+
self._check_parameter('Port', vif.vif_name, 'tag', 4095)
|
|
204
|
+
|
|
205
|
+
def test_plug_trunk_bridge_ignores_isolate_vif(self):
|
|
206
|
+
with mock.patch.object(self.plugin.config, 'isolate_vif', True):
|
|
207
|
+
network = objects.network.Network(
|
|
208
|
+
id='ef98b384-3a0f-11ef-9009-47345fca266f',
|
|
209
|
+
bridge='tbr-ef98b384',
|
|
210
|
+
subnets=self.subnets,
|
|
211
|
+
vlan=99)
|
|
212
|
+
vif = objects.vif.VIFOpenVSwitch(
|
|
213
|
+
id='631f52bc-3a07-11ef-a006-1319ef9d6edd',
|
|
214
|
+
address='ca:fe:de:ad:be:ef',
|
|
215
|
+
network=network,
|
|
216
|
+
port_profile=self.profile_ovs_system,
|
|
217
|
+
vif_name='port-631f52bc')
|
|
218
|
+
self.plugin.plug(vif, self.instance)
|
|
219
|
+
self.addCleanup(self._del_bridge, 'tbr-ef98b384')
|
|
220
|
+
self._check_parameter('Port', vif.vif_name, 'tag', [])
|
|
@@ -53,24 +53,14 @@ class BaseOVSTest(testtools.TestCase):
|
|
|
53
53
|
calls = [mock.call('Interface', 'device', ('mtu_request', 1500))]
|
|
54
54
|
self.mock_db_set.assert_has_calls(calls)
|
|
55
55
|
|
|
56
|
-
@mock.patch('sys.platform', constants.PLATFORM_LINUX)
|
|
57
56
|
@mock.patch.object(linux_net, 'set_device_mtu')
|
|
58
|
-
def
|
|
57
|
+
def test__update_device_mtu_interface_not_vhostuser(self,
|
|
59
58
|
mock_set_device_mtu):
|
|
60
59
|
self.br.update_device_mtu(
|
|
61
60
|
self.mock_transaction, 'device', 1500, 'not_vhost'
|
|
62
61
|
)
|
|
63
62
|
mock_set_device_mtu.assert_has_calls([mock.call('device', 1500)])
|
|
64
63
|
|
|
65
|
-
@mock.patch('sys.platform', constants.PLATFORM_WIN32)
|
|
66
|
-
@mock.patch.object(linux_net, 'set_device_mtu')
|
|
67
|
-
def test__update_device_mtu_interface_not_vhostuser_windows(self,
|
|
68
|
-
mock_set_device_mtu):
|
|
69
|
-
self.br.update_device_mtu(
|
|
70
|
-
self.mock_transaction, 'device', 1500, 'not_vhost'
|
|
71
|
-
)
|
|
72
|
-
mock_set_device_mtu.assert_not_called()
|
|
73
|
-
|
|
74
64
|
def test__update_device_mtu_interface_vhostuser_supports_mtu_req(self):
|
|
75
65
|
with mock.patch.object(self.br, '_ovs_supports_mtu_requests',
|
|
76
66
|
return_value=True), \
|
|
@@ -219,7 +219,10 @@ class PluginTest(testtools.TestCase):
|
|
|
219
219
|
self.vif_ovs.address, self.instance.uuid,
|
|
220
220
|
mtu=plugin.config.network_device_mtu,
|
|
221
221
|
interface_type=constants.OVS_VHOSTUSER_INTERFACE_TYPE,
|
|
222
|
-
tag=constants.DEAD_VLAN
|
|
222
|
+
tag=constants.DEAD_VLAN,
|
|
223
|
+
vlan_mode='trunk',
|
|
224
|
+
trunks=constants.DEAD_VLAN
|
|
225
|
+
)
|
|
223
226
|
|
|
224
227
|
@mock.patch.object(ovsdb_lib.BaseOVS, 'create_ovs_vif_port')
|
|
225
228
|
@mock.patch.object(ovsdb_lib.BaseOVS, 'port_exists')
|
|
@@ -238,20 +241,16 @@ class PluginTest(testtools.TestCase):
|
|
|
238
241
|
mtu=plugin.config.network_device_mtu,
|
|
239
242
|
interface_type=constants.OVS_VHOSTUSER_INTERFACE_TYPE)
|
|
240
243
|
|
|
241
|
-
@mock.patch.object(ovs, 'sys')
|
|
242
244
|
@mock.patch.object(ovs.OvsPlugin, '_plug_vif_generic')
|
|
243
|
-
def test_plug_ovs_port_bridge_false(self, plug_vif_generic
|
|
244
|
-
mock_sys.platform = 'linux'
|
|
245
|
+
def test_plug_ovs_port_bridge_false(self, plug_vif_generic):
|
|
245
246
|
plugin = ovs.OvsPlugin.load(constants.PLUGIN_NAME)
|
|
246
247
|
with mock.patch.object(plugin.config, 'per_port_bridge', False):
|
|
247
248
|
plugin.plug(self.vif_ovs, self.instance)
|
|
248
249
|
plug_vif_generic.assert_called_once_with(
|
|
249
250
|
self.vif_ovs, self.instance)
|
|
250
251
|
|
|
251
|
-
@mock.patch.object(ovs, 'sys')
|
|
252
252
|
@mock.patch.object(ovs.OvsPlugin, '_plug_port_bridge')
|
|
253
|
-
def test_plug_ovs_port_bridge_true(self, plug_vif
|
|
254
|
-
mock_sys.platform = 'linux'
|
|
253
|
+
def test_plug_ovs_port_bridge_true(self, plug_vif):
|
|
255
254
|
plugin = ovs.OvsPlugin.load(constants.PLUGIN_NAME)
|
|
256
255
|
with mock.patch.object(plugin.config, 'per_port_bridge', True):
|
|
257
256
|
plugin.plug(self.vif_ovs, self.instance)
|
|
@@ -276,8 +275,7 @@ class PluginTest(testtools.TestCase):
|
|
|
276
275
|
@mock.patch.object(linux_net, 'create_veth_pair')
|
|
277
276
|
@mock.patch.object(ip_lib, 'exists')
|
|
278
277
|
@mock.patch.object(linux_net, 'ensure_bridge')
|
|
279
|
-
|
|
280
|
-
def test_plug_ovs_bridge(self, mock_sys, ensure_bridge, device_exists,
|
|
278
|
+
def test_plug_ovs_bridge(self, ensure_bridge, device_exists,
|
|
281
279
|
create_veth_pair, update_veth_pair,
|
|
282
280
|
add_bridge_port, _create_vif_port,
|
|
283
281
|
_update_vif_port, ensure_ovs_bridge,
|
|
@@ -307,7 +305,6 @@ class PluginTest(testtools.TestCase):
|
|
|
307
305
|
# plugging new devices should result in devices being created
|
|
308
306
|
|
|
309
307
|
device_exists.return_value = False
|
|
310
|
-
mock_sys.platform = 'linux'
|
|
311
308
|
plugin = ovs.OvsPlugin.load(constants.PLUGIN_NAME)
|
|
312
309
|
plugin.plug(self.vif_ovs_hybrid, self.instance)
|
|
313
310
|
ensure_bridge.assert_has_calls(calls['ensure_bridge'])
|
|
@@ -333,38 +330,10 @@ class PluginTest(testtools.TestCase):
|
|
|
333
330
|
update_veth_pair.assert_has_calls(calls['update_veth_pair'])
|
|
334
331
|
_update_vif_port.assert_has_calls(calls['_update_vif_port'])
|
|
335
332
|
|
|
336
|
-
@mock.patch.object(ovsdb_lib.BaseOVS, 'ensure_ovs_bridge')
|
|
337
|
-
@mock.patch.object(ovs.OvsPlugin, '_create_vif_port')
|
|
338
|
-
@mock.patch.object(ip_lib, 'exists', return_value=False)
|
|
339
|
-
@mock.patch.object(ovs, 'sys')
|
|
340
|
-
def _check_plug_ovs_windows(self, vif, mock_sys, mock_exists,
|
|
341
|
-
_create_vif_port, ensure_ovs_bridge):
|
|
342
|
-
dp_type = ovs.OvsPlugin._get_vif_datapath_type(vif)
|
|
343
|
-
calls = {
|
|
344
|
-
'exists': [mock.call(vif.id)],
|
|
345
|
-
'_create_vif_port': [mock.call(vif, vif.id, self.instance)],
|
|
346
|
-
'ensure_ovs_bridge': [mock.call('br0', dp_type)]
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
mock_sys.platform = constants.PLATFORM_WIN32
|
|
350
|
-
plugin = ovs.OvsPlugin.load(constants.PLUGIN_NAME)
|
|
351
|
-
plugin.plug(vif, self.instance)
|
|
352
|
-
mock_exists.assert_has_calls(calls['exists'])
|
|
353
|
-
_create_vif_port.assert_has_calls(calls['_create_vif_port'])
|
|
354
|
-
ensure_ovs_bridge.assert_has_calls(calls['ensure_ovs_bridge'])
|
|
355
|
-
|
|
356
|
-
def test_plug_ovs_windows(self):
|
|
357
|
-
self._check_plug_ovs_windows(self.vif_ovs)
|
|
358
|
-
|
|
359
|
-
def test_plug_ovs_bridge_windows(self):
|
|
360
|
-
self._check_plug_ovs_windows(self.vif_ovs_hybrid)
|
|
361
|
-
|
|
362
333
|
@mock.patch.object(ovsdb_lib.BaseOVS, 'delete_ovs_bridge')
|
|
363
|
-
@mock.patch.object(ovs, 'sys')
|
|
364
334
|
@mock.patch.object(ovs.OvsPlugin, '_unplug_vif_generic')
|
|
365
|
-
def test_unplug_ovs_port_bridge_false(self, unplug,
|
|
335
|
+
def test_unplug_ovs_port_bridge_false(self, unplug,
|
|
366
336
|
delete_ovs_bridge):
|
|
367
|
-
mock_sys.platform = 'linux'
|
|
368
337
|
plugin = ovs.OvsPlugin.load(constants.PLUGIN_NAME)
|
|
369
338
|
with mock.patch.object(plugin.config, 'per_port_bridge', False):
|
|
370
339
|
plugin.unplug(self.vif_ovs, self.instance)
|
|
@@ -372,11 +341,9 @@ class PluginTest(testtools.TestCase):
|
|
|
372
341
|
delete_ovs_bridge.assert_not_called()
|
|
373
342
|
|
|
374
343
|
@mock.patch.object(ovsdb_lib.BaseOVS, 'delete_ovs_bridge')
|
|
375
|
-
@mock.patch.object(ovs, 'sys')
|
|
376
344
|
@mock.patch.object(ovs.OvsPlugin, '_unplug_port_bridge')
|
|
377
|
-
def test_unplug_ovs_port_bridge_true(self, unplug,
|
|
345
|
+
def test_unplug_ovs_port_bridge_true(self, unplug,
|
|
378
346
|
delete_ovs_bridge):
|
|
379
|
-
mock_sys.platform = 'linux'
|
|
380
347
|
plugin = ovs.OvsPlugin.load(constants.PLUGIN_NAME)
|
|
381
348
|
with mock.patch.object(plugin.config, 'per_port_bridge', True):
|
|
382
349
|
plugin.unplug(self.vif_ovs, self.instance)
|
|
@@ -394,8 +361,7 @@ class PluginTest(testtools.TestCase):
|
|
|
394
361
|
@mock.patch.object(ovsdb_lib.BaseOVS, 'delete_ovs_bridge')
|
|
395
362
|
@mock.patch.object(ovsdb_lib.BaseOVS, 'delete_ovs_vif_port')
|
|
396
363
|
@mock.patch.object(linux_net, 'delete_bridge')
|
|
397
|
-
|
|
398
|
-
def test_unplug_ovs_bridge(self, mock_sys, delete_bridge,
|
|
364
|
+
def test_unplug_ovs_bridge(self, delete_bridge,
|
|
399
365
|
delete_ovs_vif_port, delete_ovs_bridge):
|
|
400
366
|
calls = {
|
|
401
367
|
'delete_bridge': [mock.call('qbrvif-xxx-yyy', 'qvbb679325f-ca')],
|
|
@@ -403,32 +369,12 @@ class PluginTest(testtools.TestCase):
|
|
|
403
369
|
'br0', 'qvob679325f-ca', qos_type='linux-noop'
|
|
404
370
|
)]
|
|
405
371
|
}
|
|
406
|
-
mock_sys.platform = 'linux'
|
|
407
372
|
plugin = ovs.OvsPlugin.load(constants.PLUGIN_NAME)
|
|
408
373
|
plugin.unplug(self.vif_ovs_hybrid, self.instance)
|
|
409
374
|
delete_bridge.assert_has_calls(calls['delete_bridge'])
|
|
410
375
|
delete_ovs_vif_port.assert_has_calls(calls['delete_ovs_vif_port'])
|
|
411
376
|
delete_ovs_bridge.assert_not_called()
|
|
412
377
|
|
|
413
|
-
@mock.patch.object(ovsdb_lib.BaseOVS, 'delete_ovs_vif_port')
|
|
414
|
-
@mock.patch.object(ovs, 'sys')
|
|
415
|
-
def _check_unplug_ovs_windows(self, vif, mock_sys, delete_ovs_vif_port):
|
|
416
|
-
mock_sys.platform = constants.PLATFORM_WIN32
|
|
417
|
-
plugin = ovs.OvsPlugin.load(constants.PLUGIN_NAME)
|
|
418
|
-
plugin.unplug(vif, self.instance)
|
|
419
|
-
delete_ovs_vif_port.assert_called_once_with('br0', vif.id,
|
|
420
|
-
delete_netdev=False)
|
|
421
|
-
|
|
422
|
-
@mock.patch.object(ovsdb_lib.BaseOVS, 'delete_ovs_bridge')
|
|
423
|
-
def test_unplug_ovs_windows(self, delete_ovs_bridge):
|
|
424
|
-
self._check_unplug_ovs_windows(self.vif_ovs)
|
|
425
|
-
delete_ovs_bridge.assert_not_called()
|
|
426
|
-
|
|
427
|
-
@mock.patch.object(ovsdb_lib.BaseOVS, 'delete_ovs_bridge')
|
|
428
|
-
def test_unplug_ovs_bridge_windows(self, delete_ovs_bridge):
|
|
429
|
-
self._check_unplug_ovs_windows(self.vif_ovs_hybrid)
|
|
430
|
-
delete_ovs_bridge.assert_not_called()
|
|
431
|
-
|
|
432
378
|
@mock.patch.object(ovs.OvsPlugin, '_create_vif_port')
|
|
433
379
|
def test_plug_ovs_vhostuser(self, _create_vif_port):
|
|
434
380
|
dp_type = ovs.OvsPlugin._get_vif_datapath_type(self.vif_vhostuser)
|
|
File without changes
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
# Derived from: neutron/agent/windows/ip_lib.py
|
|
2
|
-
#
|
|
3
|
-
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
4
|
-
# not use this file except in compliance with the License. You may obtain
|
|
5
|
-
# a copy of the License at
|
|
6
|
-
#
|
|
7
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
-
#
|
|
9
|
-
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
-
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
11
|
-
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
12
|
-
# License for the specific language governing permissions and limitations
|
|
13
|
-
# under the License.
|
|
14
|
-
|
|
15
|
-
import netifaces
|
|
16
|
-
|
|
17
|
-
from oslo_log import log as logging
|
|
18
|
-
|
|
19
|
-
from os_vif import exception
|
|
20
|
-
from os_vif.internal.ip import ip_command
|
|
21
|
-
|
|
22
|
-
LOG = logging.getLogger(__name__)
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
class Netifaces(ip_command.IpCommand):
|
|
26
|
-
|
|
27
|
-
def exists(self, device):
|
|
28
|
-
"""Return True if the device exists in the namespace."""
|
|
29
|
-
try:
|
|
30
|
-
return bool(netifaces.ifaddresses(device))
|
|
31
|
-
except ValueError:
|
|
32
|
-
LOG.warning("The device does not exist on the system: %s", device)
|
|
33
|
-
return False
|
|
34
|
-
except OSError:
|
|
35
|
-
LOG.error("Failed to get interface addresses: %s", device)
|
|
36
|
-
return False
|
|
37
|
-
|
|
38
|
-
def set(self, device, check_exit_code=None, state=None, mtu=None,
|
|
39
|
-
address=None, promisc=None, master=None):
|
|
40
|
-
exception.NotImplementedForOS(function='ip.set', os='Windows')
|
|
41
|
-
|
|
42
|
-
def add(self, device, dev_type, check_exit_code=None, peer=None, link=None,
|
|
43
|
-
vlan_id=None):
|
|
44
|
-
exception.NotImplementedForOS(function='ip.add', os='Windows')
|
|
45
|
-
|
|
46
|
-
def delete(self, device, check_exit_code=None):
|
|
47
|
-
exception.NotImplementedForOS(function='ip.delete', os='Windows')
|
|
File without changes
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
2
|
-
# not use this file except in compliance with the License. You may obtain
|
|
3
|
-
# a copy of the License at
|
|
4
|
-
#
|
|
5
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
-
#
|
|
7
|
-
# Unless required by applicable law or agreed to in writing, software
|
|
8
|
-
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
9
|
-
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
10
|
-
# License for the specific language governing permissions and limitations
|
|
11
|
-
# under the License.
|
|
12
|
-
|
|
13
|
-
from unittest import mock
|
|
14
|
-
|
|
15
|
-
import netifaces
|
|
16
|
-
|
|
17
|
-
from os_vif.internal.ip.windows import impl_netifaces as ip_lib
|
|
18
|
-
from os_vif.tests.unit import base
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
class TestIPDevice(base.TestCase):
|
|
22
|
-
|
|
23
|
-
def setUp(self):
|
|
24
|
-
super(TestIPDevice, self).setUp()
|
|
25
|
-
self.device_name = 'test_device'
|
|
26
|
-
self.mock_log = mock.patch.object(ip_lib, "LOG").start()
|
|
27
|
-
self.ip_lib = ip_lib.Netifaces()
|
|
28
|
-
|
|
29
|
-
@mock.patch.object(netifaces, 'ifaddresses', return_value=True)
|
|
30
|
-
def test_exists(self, mock_ifaddresses):
|
|
31
|
-
self.assertTrue(self.ip_lib.exists(self.device_name))
|
|
32
|
-
mock_ifaddresses.assert_called_once_with(self.device_name)
|
|
33
|
-
|
|
34
|
-
@mock.patch.object(netifaces, 'ifaddresses', side_effect=ValueError())
|
|
35
|
-
def test_exists_not_found(self, mock_ifaddresses):
|
|
36
|
-
self.assertFalse(self.ip_lib.exists(self.device_name))
|
|
37
|
-
mock_ifaddresses.assert_called_once_with(self.device_name)
|
|
38
|
-
self.mock_log.warning.assert_called_once_with(
|
|
39
|
-
"The device does not exist on the system: %s", self.device_name)
|
|
40
|
-
|
|
41
|
-
@mock.patch.object(netifaces, 'ifaddresses', side_effect=OSError())
|
|
42
|
-
def test_exists_os_error_exception(self, mock_ifaddresses):
|
|
43
|
-
self.assertFalse(self.ip_lib.exists(self.device_name))
|
|
44
|
-
mock_ifaddresses.assert_called_once_with(self.device_name)
|
|
45
|
-
self.mock_log.error.assert_called_once_with(
|
|
46
|
-
"Failed to get interface addresses: %s", self.device_name)
|
os_vif-3.7.0.dist-info/pbr.json
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"git_version": "bb3e3da", "is_release": true}
|
|
File without changes
|
|
File without changes
|