Browse Source

Update requirements and modules to match neutron

Because of the current status of neutron,
neutron_lib and networking-vsphere, the following
has to be submitted as one patch or unit test will
not pass.

https://review.openstack.org/#/c/553644/
**The neutron project has moved some modules
to different locations:

-neutron is now available as a pip package
It needs to be installed by the requirements.txt file

-topics was moved from neutron.common to neutron_lib.agent
securitygroups_rpc was moved tno neutron.api.rpc.handlers

https://review.openstack.org/#/c/534734
**remove use of attributes.PLURALS
Neutron's attributes module doesn't contain the PLURALS global anymore.
This patch cleans up its usage.

https://review.openstack.org/#/c/534445
**We are looking to modify the neutron rpc APIs [1] to slim its surface
area and prep for rehoming into neutron lib. This patch removes the use
of add_extra_exmods/clear_extra_exmods in the unit tests; it's not
needed and will change in [1].

[1] I51607216a39980c17807dcccace3ab66b549607b

Change-Id: Ice3c7f635966f0aecce327b667ada82af575d747
Boden R 1 year ago
parent
commit
e1146cc01b

+ 4
- 3
networking_vsphere/agent/dvs_neutron_agent.py View File

@@ -29,11 +29,12 @@ from neutron_lib.utils import helpers
29 29
 
30 30
 from neutron.agent.common import polling
31 31
 from neutron.agent import rpc as agent_rpc
32
-from neutron.agent import securitygroups_rpc as sg_rpc
32
+from neutron.agent import securitygroups_rpc as sga_rpc
33
+from neutron.api.rpc.handlers import securitygroups_rpc as sg_rpc
33 34
 from neutron.common import config as common_config
34 35
 from neutron.common import constants as n_const
35
-from neutron.common import topics
36 36
 from neutron.common import utils
37
+from neutron_lib.agent import topics
37 38
 
38 39
 from networking_vsphere.agent.firewalls import dvs_securitygroup_rpc as dvs_rpc
39 40
 from networking_vsphere.common import constants as dvs_const
@@ -178,7 +179,7 @@ class DVSAgent(sg_rpc.SecurityGroupAgentRpcCallbackMixin,
178 179
                 'no mapping from network to DVS.') % {'port_id': current['id']}
179 180
             )
180 181
         else:
181
-            if sg_rpc.is_firewall_enabled():
182
+            if sga_rpc.is_firewall_enabled():
182 183
                 key = current.get(
183 184
                     'binding:vif_details', {}).get('dvs_port_key')
184 185
                 if key:

+ 1
- 1
networking_vsphere/agent/ovsvapp_agent.py View File

@@ -25,6 +25,7 @@ import oslo_messaging
25 25
 from oslo_service import loopingcall
26 26
 import six
27 27
 
28
+from neutron_lib.agent import topics
28 29
 from neutron_lib import constants as p_const
29 30
 from neutron_lib import context
30 31
 from neutron_lib.utils import helpers
@@ -32,7 +33,6 @@ from neutron_lib.utils import helpers
32 33
 from neutron.agent.common import ovs_lib
33 34
 from neutron.agent import rpc as agent_rpc
34 35
 from neutron.common import rpc as n_rpc
35
-from neutron.common import topics
36 36
 from neutron.plugins.common import utils as p_utils
37 37
 from neutron.plugins.ml2.drivers.openvswitch.agent.common import constants as ovs_const  # noqa
38 38
 from neutron.plugins.ml2.drivers.openvswitch.agent import ovs_neutron_agent as ovs_agent  # noqa

+ 1
- 1
networking_vsphere/common/dvs_agent_rpc_api.py View File

@@ -14,7 +14,7 @@
14 14
 #    under the License.
15 15
 
16 16
 from neutron.common import rpc as n_rpc
17
-from neutron.common import topics
17
+from neutron_lib.agent import topics
18 18
 import oslo_messaging
19 19
 
20 20
 from networking_vsphere.common import constants as dvs_const

+ 0
- 2
networking_vsphere/extensions/ovsvapp_cluster.py View File

@@ -19,7 +19,6 @@ from neutron_lib.api import extensions as api_extensions
19 19
 from neutron_lib.api import validators
20 20
 
21 21
 from neutron.api import extensions
22
-from neutron.api.v2 import attributes
23 22
 from neutron.api.v2 import resource_helper
24 23
 
25 24
 from networking_vsphere._i18n import _
@@ -89,7 +88,6 @@ class Ovsvapp_cluster(api_extensions.ExtensionDescriptor):
89 88
         """Returns Ext Resources."""
90 89
         plural_mappings = resource_helper.build_plural_mappings(
91 90
             {}, RESOURCE_ATTRIBUTE_MAP)
92
-        attributes.PLURALS.update(plural_mappings)
93 91
         resources = resource_helper.build_resource_info(
94 92
             plural_mappings,
95 93
             RESOURCE_ATTRIBUTE_MAP,

+ 0
- 2
networking_vsphere/extensions/ovsvapp_mitigated_cluster.py View File

@@ -15,7 +15,6 @@
15 15
 
16 16
 import abc
17 17
 
18
-from neutron.api.v2 import attributes as attr
19 18
 from neutron.api.v2 import resource_helper
20 19
 
21 20
 from neutron_lib.api import converters
@@ -71,7 +70,6 @@ class Ovsvapp_mitigated_cluster(extensions.ExtensionDescriptor):
71 70
         """Returns Ext Resources."""
72 71
         plural_mappings = resource_helper.build_plural_mappings(
73 72
             {}, RESOURCE_ATTRIBUTE_MAP)
74
-        attr.PLURALS.update(plural_mappings)
75 73
         resources = resource_helper.build_resource_info(
76 74
             plural_mappings,
77 75
             RESOURCE_ATTRIBUTE_MAP,

+ 2
- 1
networking_vsphere/ml2/ovsvapp_mech_driver.py View File

@@ -22,9 +22,10 @@ from oslo_log import log
22 22
 from oslo_utils import timeutils
23 23
 
24 24
 from neutron.common import rpc as n_rpc
25
-from neutron.common import topics
25
+
26 26
 from neutron import manager
27 27
 from neutron.plugins.ml2.drivers import mech_agent
28
+from neutron_lib.agent import topics
28 29
 from neutron_lib.api.definitions import portbindings
29 30
 from neutron_lib import constants as n_const
30 31
 from neutron_lib import context as neutron_context

+ 1
- 1
networking_vsphere/ml2/ovsvapp_rpc.py View File

@@ -26,13 +26,13 @@ from networking_vsphere.common import utils as ovsvapp_utils
26 26
 from networking_vsphere.db import ovsvapp_db
27 27
 
28 28
 from neutron.common import rpc as n_rpc
29
-from neutron.common import topics
30 29
 from neutron.db import models_v2
31 30
 from neutron.db import securitygroups_rpc_base as sg_rpc_base
32 31
 from neutron.plugins.ml2 import db
33 32
 from neutron.plugins.ml2 import driver_context
34 33
 from neutron.plugins.ml2 import managers
35 34
 from neutron.plugins.ml2 import rpc as plugin_rpc
35
+from neutron_lib.agent import topics
36 36
 from neutron_lib.api.definitions import portbindings
37 37
 from neutron_lib import constants as common_const
38 38
 from neutron_lib.plugins.ml2 import api

+ 0
- 4
networking_vsphere/tests/base.py View File

@@ -63,10 +63,6 @@ class TestCase(base.BaseTestCase):
63 63
         self.messaging_conf.response_timeout = 0
64 64
         self.useFixture(self.messaging_conf)
65 65
 
66
-        self.addCleanup(n_rpc.clear_extra_exmods)
67
-        n_rpc.add_extra_exmods('neutron.test')
68
-
69
-        self.addCleanup(n_rpc.cleanup)
70 66
         n_rpc.init(CONF)
71 67
 
72 68
     def flags(self, **kw):

+ 4
- 2
networking_vsphere/tests/unit/agent/test_ovsvapp_agent.py View File

@@ -148,7 +148,8 @@ class TestOVSvAppAgentRestart(base.TestCase):
148 148
     @mock.patch('neutron.common.config.setup_logging')
149 149
     @mock.patch('neutron.agent.ovsdb.api.from_config')
150 150
     @mock.patch('networking_vsphere.agent.ovsvapp_agent.RpcPluginApi')
151
-    @mock.patch('neutron.agent.securitygroups_rpc.SecurityGroupServerRpcApi')
151
+    @mock.patch('neutron.api.rpc.handlers.securitygroups_rpc.'
152
+                'SecurityGroupServerRpcApi')
152 153
     @mock.patch('neutron.agent.rpc.PluginReportStateAPI')
153 154
     @mock.patch('networking_vsphere.agent.ovsvapp_agent.OVSvAppPluginApi')
154 155
     @mock.patch('neutron_lib.context.get_admin_context_without_session')
@@ -304,7 +305,8 @@ class TestOVSvAppAgent(base.TestCase):
304 305
     @mock.patch('neutron.common.config.setup_logging')
305 306
     @mock.patch('neutron.agent.ovsdb.api.from_config')
306 307
     @mock.patch('networking_vsphere.agent.ovsvapp_agent.RpcPluginApi')
307
-    @mock.patch('neutron.agent.securitygroups_rpc.SecurityGroupServerRpcApi')
308
+    @mock.patch('neutron.api.rpc.handlers.securitygroups_rpc.'
309
+                'SecurityGroupServerRpcApi')
308 310
     @mock.patch('neutron.agent.rpc.PluginReportStateAPI')
309 311
     @mock.patch('networking_vsphere.agent.ovsvapp_agent.OVSvAppPluginApi')
310 312
     @mock.patch('neutron_lib.context.get_admin_context_without_session')

+ 1
- 1
networking_vsphere/tests/unit/ml2/test_ovsvapp_rpc.py View File

@@ -21,10 +21,10 @@ from neutron_lib.plugins import directory
21 21
 from neutron_lib.plugins.ml2 import api
22 22
 from oslo_config import cfg
23 23
 
24
-from neutron.common import topics
25 24
 from neutron.plugins.ml2 import rpc as plugin_rpc
26 25
 from neutron.tests.unit.plugins.ml2 import _test_mech_agent as base
27 26
 from neutron.tests.unit.plugins.ml2 import test_rpc
27
+from neutron_lib.agent import topics
28 28
 
29 29
 from networking_vsphere.agent import ovsvapp_agent
30 30
 from networking_vsphere.agent import ovsvapp_sg_agent

+ 1
- 1
networking_vsphere/tests/unit/monitor/test_ovsvapp_monitor.py View File

@@ -23,9 +23,9 @@ from oslo_serialization import jsonutils
23 23
 from oslo_service import loopingcall
24 24
 from oslo_utils import timeutils
25 25
 
26
-from neutron.common import topics
27 26
 from neutron.db import agents_db
28 27
 from neutron.tests import base
28
+from neutron_lib.agent import topics
29 29
 from neutron_lib import constants
30 30
 from neutron_lib import context as neutron_context
31 31
 

+ 1
- 1
requirements.txt View File

@@ -5,11 +5,11 @@
5 5
 pbr!=2.1.0,>=2.0.0 # Apache-2.0
6 6
 Babel!=2.4.0,>=2.3.4 # BSD
7 7
 neutron-lib>=1.11.0 # Apache-2.0
8
+neutron>=12.0.0 # Apache-2.0
8 9
 oslo.vmware>=2.17.0 # Apache-2.0
9 10
 ovsdbapp>=0.6.0 # Apache-2.0
10 11
 
11 12
 # This project does depend on neutron, nova as a library, but the
12 13
 # openstack tooling does not play nicely with projects that
13 14
 # are not publicly available in pypi.
14
-# -e git+https://git.openstack.org/openstack/neutron#egg=neutron
15 15
 # -e git+https://git.openstack.org/openstack/nova#egg=nova

+ 1
- 2
tox.ini View File

@@ -8,8 +8,7 @@ setenv = VIRTUAL_ENV={envdir}
8 8
 passenv = TRACE_FAILONLY
9 9
 usedevelop = True
10 10
 install_command = pip install -c{env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt} -U {opts} {packages}
11
-deps = -egit+https://git.openstack.org/openstack/neutron@master#egg=neutron
12
-       -egit+https://git.openstack.org/openstack/nova@master#egg=nova
11
+deps = -egit+https://git.openstack.org/openstack/nova@master#egg=nova
13 12
        -r{toxinidir}/requirements.txt
14 13
        -r{toxinidir}/test-requirements.txt
15 14
 whitelist_externals = sh

Loading…
Cancel
Save