summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShinji YANAGIDA <s-yanagida@pb.jp.nec.com>2016-11-23 19:18:51 +0900
committerShinji YANAGIDA <s-yanagida@pb.jp.nec.com>2016-11-23 19:21:17 +0900
commit7f8d01f9d96f6717d0e4379829d13f1689ddbc88 (patch)
treebc852d3ed8146e95b33879d9ed3e407e72fce4d1
parentf4df16396858076a7e01bc820b4aa2485c682a3e (diff)
change import path.
I changed the following path. neutron.plugins.ml2.db -> neutron.db.segments_db Change-Id: I2ddd63a31d8ba20a7fd4b7efe3aed3d0d8501eb6
Notes
Notes (review): Code-Review+2: Shinji YANAGIDA <s-yanagida@pb.jp.nec.com> Workflow+1: Shinji YANAGIDA <s-yanagida@pb.jp.nec.com> Verified+2: Jenkins Submitted-by: Jenkins Submitted-at: Wed, 23 Nov 2016 10:33:49 +0000 Reviewed-on: https://review.openstack.org/401180 Project: openstack/networking-nec Branch: refs/heads/master
-rw-r--r--networking_nec/nwa/l2/drivers/mech_necnwa.py10
-rw-r--r--networking_nec/nwa/l2/plugin.py2
-rw-r--r--networking_nec/nwa/l2/rpc/nwa_l2_server_callback.py2
-rw-r--r--networking_nec/nwa/l2/utils.py2
-rw-r--r--networking_nec/tests/unit/nwa/l2/drivers/test_mech_necnwa.py10
-rw-r--r--networking_nec/tests/unit/nwa/l2/rpc/test_ml2_server_callback.py14
-rw-r--r--networking_nec/tests/unit/nwa/l2/rpc/test_nwa_l2_server_callback.py4
-rw-r--r--networking_nec/tests/unit/nwa/l2/test_plugin.py6
-rw-r--r--networking_nec/tests/unit/nwa/l3/test_plugin.py2
9 files changed, 26 insertions, 26 deletions
diff --git a/networking_nec/nwa/l2/drivers/mech_necnwa.py b/networking_nec/nwa/l2/drivers/mech_necnwa.py
index 344263f..6fd8daf 100644
--- a/networking_nec/nwa/l2/drivers/mech_necnwa.py
+++ b/networking_nec/nwa/l2/drivers/mech_necnwa.py
@@ -14,10 +14,10 @@
14 14
15from neutron.common import constants as neutron_const 15from neutron.common import constants as neutron_const
16from neutron.common import utils 16from neutron.common import utils
17from neutron.db import segments_db as db_ml2
17from neutron.extensions import portbindings 18from neutron.extensions import portbindings
18from neutron.extensions import providernet as prov_net 19from neutron.extensions import providernet as prov_net
19from neutron.plugins.common import constants as plugin_const 20from neutron.plugins.common import constants as plugin_const
20from neutron.plugins.ml2 import db
21from neutron.plugins.ml2 import driver_api as api 21from neutron.plugins.ml2 import driver_api as api
22from neutron.plugins.ml2.drivers.openvswitch.mech_driver \ 22from neutron.plugins.ml2.drivers.openvswitch.mech_driver \
23 import mech_openvswitch as ovs 23 import mech_openvswitch as ovs
@@ -129,7 +129,7 @@ class NECNWAMechanismDriver(ovs.OpenvswitchMechanismDriver):
129 return 129 return
130 network_id = context.network.current['id'] 130 network_id = context.network.current['id']
131 session = context.network._plugin_context.session 131 session = context.network._plugin_context.session
132 dummy_segment = db.get_dynamic_segment( 132 dummy_segment = db_ml2.get_dynamic_segment(
133 session, network_id, physical_network=physical_network) 133 session, network_id, physical_network=physical_network)
134 LOG.debug("1st: dummy segment is %s", dummy_segment) 134 LOG.debug("1st: dummy segment is %s", dummy_segment)
135 if not dummy_segment: 135 if not dummy_segment:
@@ -138,7 +138,7 @@ class NECNWAMechanismDriver(ovs.OpenvswitchMechanismDriver):
138 api.NETWORK_TYPE: plugin_const.TYPE_VLAN, 138 api.NETWORK_TYPE: plugin_const.TYPE_VLAN,
139 api.SEGMENTATION_ID: 0 139 api.SEGMENTATION_ID: 0
140 } 140 }
141 db.add_network_segment( 141 db_ml2.add_network_segment(
142 session, network_id, dummy_segment, is_dynamic=True) 142 session, network_id, dummy_segment, is_dynamic=True)
143 LOG.debug("2nd: dummy segment is %s", dummy_segment) 143 LOG.debug("2nd: dummy segment is %s", dummy_segment)
144 context.set_binding(dummy_segment[api.ID], 144 context.set_binding(dummy_segment[api.ID],
@@ -221,13 +221,13 @@ class NECNWAMechanismDriver(ovs.OpenvswitchMechanismDriver):
221 221
222 def _l2_delete_segment(self, context, nwa_info): 222 def _l2_delete_segment(self, context, nwa_info):
223 session = context.network._plugin_context.session 223 session = context.network._plugin_context.session
224 del_segment = db.get_dynamic_segment( 224 del_segment = db_ml2.get_dynamic_segment(
225 session, 225 session,
226 context.network.current['id'], 226 context.network.current['id'],
227 physical_network=nwa_info['physical_network']) 227 physical_network=nwa_info['physical_network'])
228 if del_segment: 228 if del_segment:
229 LOG.debug('delete_network_segment %s', del_segment) 229 LOG.debug('delete_network_segment %s', del_segment)
230 db.delete_network_segment(session, del_segment['id']) 230 db_ml2.delete_network_segment(session, del_segment['id'])
231 231
232 def _l3_create_tenant_fw(self, context): 232 def _l3_create_tenant_fw(self, context):
233 device_owner = context._port['device_owner'] 233 device_owner = context._port['device_owner']
diff --git a/networking_nec/nwa/l2/plugin.py b/networking_nec/nwa/l2/plugin.py
index 13480b1..479b55b 100644
--- a/networking_nec/nwa/l2/plugin.py
+++ b/networking_nec/nwa/l2/plugin.py
@@ -18,9 +18,9 @@ from neutron.api.rpc.handlers import securitygroups_rpc
18from neutron.common import rpc as n_rpc 18from neutron.common import rpc as n_rpc
19from neutron.common import topics 19from neutron.common import topics
20from neutron.db import agents_db 20from neutron.db import agents_db
21from neutron.db import segments_db as db_ml2
21from neutron.extensions import multiprovidernet as mpnet 22from neutron.extensions import multiprovidernet as mpnet
22from neutron.extensions import providernet as provider 23from neutron.extensions import providernet as provider
23from neutron.plugins.ml2 import db as db_ml2
24from neutron.plugins.ml2 import driver_api as api 24from neutron.plugins.ml2 import driver_api as api
25from neutron.plugins.ml2 import plugin as ml2_plugin 25from neutron.plugins.ml2 import plugin as ml2_plugin
26from oslo_log import log as logging 26from oslo_log import log as logging
diff --git a/networking_nec/nwa/l2/rpc/nwa_l2_server_callback.py b/networking_nec/nwa/l2/rpc/nwa_l2_server_callback.py
index 67c0402..a15b29f 100644
--- a/networking_nec/nwa/l2/rpc/nwa_l2_server_callback.py
+++ b/networking_nec/nwa/l2/rpc/nwa_l2_server_callback.py
@@ -15,8 +15,8 @@
15from neutron.db import api as db_api 15from neutron.db import api as db_api
16from neutron.db.models import segment as segments_db 16from neutron.db.models import segment as segments_db
17from neutron.db import models_v2 17from neutron.db import models_v2
18from neutron.db import segments_db as db_ml2
18from neutron import manager 19from neutron import manager
19from neutron.plugins.ml2 import db as db_ml2
20from neutron_lib import constants 20from neutron_lib import constants
21from oslo_log import helpers 21from oslo_log import helpers
22from oslo_log import log as logging 22from oslo_log import log as logging
diff --git a/networking_nec/nwa/l2/utils.py b/networking_nec/nwa/l2/utils.py
index 85d2d9b..23b4526 100644
--- a/networking_nec/nwa/l2/utils.py
+++ b/networking_nec/nwa/l2/utils.py
@@ -13,7 +13,7 @@
13# under the License. 13# under the License.
14 14
15from neutron.db.models import external_net as external_net_db 15from neutron.db.models import external_net as external_net_db
16from neutron.plugins.ml2 import db as db_ml2 16from neutron.db import segments_db as db_ml2
17from neutron.plugins.ml2 import driver_api as api 17from neutron.plugins.ml2 import driver_api as api
18from neutron_lib import constants 18from neutron_lib import constants
19from oslo_config import cfg 19from oslo_config import cfg
diff --git a/networking_nec/tests/unit/nwa/l2/drivers/test_mech_necnwa.py b/networking_nec/tests/unit/nwa/l2/drivers/test_mech_necnwa.py
index 068abaa..99c378b 100644
--- a/networking_nec/tests/unit/nwa/l2/drivers/test_mech_necnwa.py
+++ b/networking_nec/tests/unit/nwa/l2/drivers/test_mech_necnwa.py
@@ -550,15 +550,15 @@ class TestNECNWAMechanismDriver(TestMechNwa):
550 physnet = self.driver._find_nwa_physical_network(self.context) 550 physnet = self.driver._find_nwa_physical_network(self.context)
551 self.assertEqual(physnet, 'Common/App/Pod3') 551 self.assertEqual(physnet, 'Common/App/Pod3')
552 552
553 @patch('neutron.plugins.ml2.db.get_dynamic_segment') 553 @patch('neutron.db.segments_db.get_dynamic_segment')
554 def test__bind_segment_to_vif_type_dummy_segment_none(self, gds): 554 def test__bind_segment_to_vif_type_dummy_segment_none(self, gds):
555 gds.return_value = None 555 gds.return_value = None
556 physnet = 'Common/App/Pod3' 556 physnet = 'Common/App/Pod3'
557 rd = self.driver._bind_segment_to_vif_type(self.context, physnet) 557 rd = self.driver._bind_segment_to_vif_type(self.context, physnet)
558 self.assertIsNone(rd) 558 self.assertIsNone(rd)
559 559
560 @patch('neutron.plugins.ml2.db.get_dynamic_segment') 560 @patch('neutron.db.segments_db.get_dynamic_segment')
561 @patch('neutron.plugins.ml2.db.add_network_segment') 561 @patch('neutron.db.segments_db.add_network_segment')
562 def test__bind_segment_to_vif_type_dummy_segment_exists(self, ans, gds): 562 def test__bind_segment_to_vif_type_dummy_segment_exists(self, ans, gds):
563 gds.return_value = self.network_segments[1] 563 gds.return_value = self.network_segments[1]
564 physnet = 'Common/KVM/Pod1-2' 564 physnet = 'Common/KVM/Pod1-2'
@@ -642,8 +642,8 @@ class TestNECNWAMechanismDriver(TestMechNwa):
642 gntb.side_effect = Exception 642 gntb.side_effect = Exception
643 self.driver._bind_port_nwa(self.context) 643 self.driver._bind_port_nwa(self.context)
644 644
645 @patch('neutron.plugins.ml2.db.get_dynamic_segment') 645 @patch('neutron.db.segments_db.get_dynamic_segment')
646 @patch('neutron.plugins.ml2.db.delete_network_segment') 646 @patch('neutron.db.segments_db.delete_network_segment')
647 def test__l2_delete_segment(self, dns, gds): 647 def test__l2_delete_segment(self, dns, gds):
648 gds.return_value = None 648 gds.return_value = None
649 self.driver._l2_delete_segment(self.context, MagicMock()) 649 self.driver._l2_delete_segment(self.context, MagicMock())
diff --git a/networking_nec/tests/unit/nwa/l2/rpc/test_ml2_server_callback.py b/networking_nec/tests/unit/nwa/l2/rpc/test_ml2_server_callback.py
index e7bd516..e374903 100644
--- a/networking_nec/tests/unit/nwa/l2/rpc/test_ml2_server_callback.py
+++ b/networking_nec/tests/unit/nwa/l2/rpc/test_ml2_server_callback.py
@@ -76,7 +76,7 @@ class TestNECNWAServerRpcCallbacks(base.BaseTestCase):
76 self.assertTrue(device) 76 self.assertTrue(device)
77 77
78 @mock.patch('neutron.plugins.ml2.plugin.Ml2Plugin.update_port_status') 78 @mock.patch('neutron.plugins.ml2.plugin.Ml2Plugin.update_port_status')
79 @mock.patch('neutron.plugins.ml2.db.get_network_segments') 79 @mock.patch('neutron.db.segments_db.get_network_segments')
80 @mock.patch('neutron.db.api.get_session') 80 @mock.patch('neutron.db.api.get_session')
81 @mock.patch('networking_nec.nwa.l2.plugin.' 81 @mock.patch('networking_nec.nwa.l2.plugin.'
82 'NECNWAL2Plugin.get_bound_port_context') 82 'NECNWAL2Plugin.get_bound_port_context')
@@ -96,7 +96,7 @@ class TestNECNWAServerRpcCallbacks(base.BaseTestCase):
96 self.assertTrue(device) 96 self.assertTrue(device)
97 97
98 @mock.patch('neutron.plugins.ml2.plugin.Ml2Plugin.update_port_status') 98 @mock.patch('neutron.plugins.ml2.plugin.Ml2Plugin.update_port_status')
99 @mock.patch('neutron.plugins.ml2.db.get_network_segments') 99 @mock.patch('neutron.db.segments_db.get_network_segments')
100 @mock.patch('neutron.db.api.get_session') 100 @mock.patch('neutron.db.api.get_session')
101 @mock.patch('networking_nec.nwa.l2.plugin.' 101 @mock.patch('networking_nec.nwa.l2.plugin.'
102 'NECNWAL2Plugin.get_bound_port_context') 102 'NECNWAL2Plugin.get_bound_port_context')
@@ -116,7 +116,7 @@ class TestNECNWAServerRpcCallbacks(base.BaseTestCase):
116 self.assertTrue(device) 116 self.assertTrue(device)
117 117
118 @mock.patch('neutron.plugins.ml2.plugin.Ml2Plugin.update_port_status') 118 @mock.patch('neutron.plugins.ml2.plugin.Ml2Plugin.update_port_status')
119 @mock.patch('neutron.plugins.ml2.db.get_network_segments') 119 @mock.patch('neutron.db.segments_db.get_network_segments')
120 @mock.patch('neutron.db.api.get_session') 120 @mock.patch('neutron.db.api.get_session')
121 @mock.patch('networking_nec.nwa.l2.plugin.' 121 @mock.patch('networking_nec.nwa.l2.plugin.'
122 'NECNWAL2Plugin.get_bound_port_context') 122 'NECNWAL2Plugin.get_bound_port_context')
@@ -135,7 +135,7 @@ class TestNECNWAServerRpcCallbacks(base.BaseTestCase):
135 self.rpc.get_device_details(rpc_context, kwargs={'test': "sample"}) 135 self.rpc.get_device_details(rpc_context, kwargs={'test': "sample"})
136 136
137 @mock.patch('neutron.plugins.ml2.plugin.Ml2Plugin.update_port_status') 137 @mock.patch('neutron.plugins.ml2.plugin.Ml2Plugin.update_port_status')
138 @mock.patch('neutron.plugins.ml2.db.get_network_segments') 138 @mock.patch('neutron.db.segments_db.get_network_segments')
139 @mock.patch('neutron.db.api.get_session') 139 @mock.patch('neutron.db.api.get_session')
140 @mock.patch('networking_nec.nwa.l2.plugin.' 140 @mock.patch('networking_nec.nwa.l2.plugin.'
141 'NECNWAL2Plugin.get_bound_port_context') 141 'NECNWAL2Plugin.get_bound_port_context')
@@ -156,7 +156,7 @@ class TestNECNWAServerRpcCallbacks(base.BaseTestCase):
156 156
157 @mock.patch('neutron.plugins.ml2.plugin.Ml2Plugin.update_port_status') 157 @mock.patch('neutron.plugins.ml2.plugin.Ml2Plugin.update_port_status')
158 @mock.patch('networking_nec.nwa.l2.db_api.ensure_port_binding') 158 @mock.patch('networking_nec.nwa.l2.db_api.ensure_port_binding')
159 @mock.patch('neutron.plugins.ml2.db.get_network_segments') 159 @mock.patch('neutron.db.segments_db.get_network_segments')
160 @mock.patch('neutron.db.api.get_session') 160 @mock.patch('neutron.db.api.get_session')
161 @mock.patch('networking_nec.nwa.l2.plugin.' 161 @mock.patch('networking_nec.nwa.l2.plugin.'
162 'NECNWAL2Plugin.get_bound_port_context') 162 'NECNWAL2Plugin.get_bound_port_context')
@@ -186,7 +186,7 @@ class TestNECNWAServerRpcCallbacks(base.BaseTestCase):
186 @mock.patch('networking_nec.nwa.l2.plugin.' 186 @mock.patch('networking_nec.nwa.l2.plugin.'
187 'NECNWAL2Plugin.update_port_status') 187 'NECNWAL2Plugin.update_port_status')
188 @mock.patch('networking_nec.nwa.l2.db_api.ensure_port_binding') 188 @mock.patch('networking_nec.nwa.l2.db_api.ensure_port_binding')
189 @mock.patch('neutron.plugins.ml2.db.get_network_segments') 189 @mock.patch('neutron.db.segments_db.get_network_segments')
190 @mock.patch('neutron.db.api.get_session') 190 @mock.patch('neutron.db.api.get_session')
191 @mock.patch('networking_nec.nwa.l2.plugin.' 191 @mock.patch('networking_nec.nwa.l2.plugin.'
192 'NECNWAL2Plugin.get_bound_port_context') 192 'NECNWAL2Plugin.get_bound_port_context')
@@ -212,7 +212,7 @@ class TestNECNWAServerRpcCallbacks(base.BaseTestCase):
212 @mock.patch('networking_nec.nwa.l2.plugin.' 212 @mock.patch('networking_nec.nwa.l2.plugin.'
213 'NECNWAL2Plugin.update_port_status') 213 'NECNWAL2Plugin.update_port_status')
214 @mock.patch('networking_nec.nwa.l2.db_api.ensure_port_binding') 214 @mock.patch('networking_nec.nwa.l2.db_api.ensure_port_binding')
215 @mock.patch('neutron.plugins.ml2.db.get_network_segments') 215 @mock.patch('neutron.db.segments_db.get_network_segments')
216 @mock.patch('neutron.db.api.get_session') 216 @mock.patch('neutron.db.api.get_session')
217 @mock.patch('networking_nec.nwa.l2.plugin.' 217 @mock.patch('networking_nec.nwa.l2.plugin.'
218 'NECNWAL2Plugin.get_bound_port_context') 218 'NECNWAL2Plugin.get_bound_port_context')
diff --git a/networking_nec/tests/unit/nwa/l2/rpc/test_nwa_l2_server_callback.py b/networking_nec/tests/unit/nwa/l2/rpc/test_nwa_l2_server_callback.py
index b41df3e..09fa806 100644
--- a/networking_nec/tests/unit/nwa/l2/rpc/test_nwa_l2_server_callback.py
+++ b/networking_nec/tests/unit/nwa/l2/rpc/test_nwa_l2_server_callback.py
@@ -26,8 +26,8 @@ class TestNwaL2ServerRpcCallback(base.BaseTestCase):
26 self.context = mock.MagicMock() 26 self.context = mock.MagicMock()
27 27
28 @mock.patch('neutron.db.api.get_session') 28 @mock.patch('neutron.db.api.get_session')
29 @mock.patch('neutron.plugins.ml2.db.get_dynamic_segment') 29 @mock.patch('neutron.db.segments_db.get_dynamic_segment')
30 @mock.patch('neutron.plugins.ml2.db.delete_network_segment') 30 @mock.patch('neutron.db.segments_db.delete_network_segment')
31 def test_release_dynamic_segment_from_agent(self, dns, gds, gs): 31 def test_release_dynamic_segment_from_agent(self, dns, gds, gs):
32 del_segment = {'segmentation_id': 0, 'id': 'ID-0'} 32 del_segment = {'segmentation_id': 0, 'id': 'ID-0'}
33 gds.return_value = del_segment 33 gds.return_value = del_segment
diff --git a/networking_nec/tests/unit/nwa/l2/test_plugin.py b/networking_nec/tests/unit/nwa/l2/test_plugin.py
index aacaf08..0463b85 100644
--- a/networking_nec/tests/unit/nwa/l2/test_plugin.py
+++ b/networking_nec/tests/unit/nwa/l2/test_plugin.py
@@ -54,7 +54,7 @@ class TestNECNWAL2Plugin(base.BaseTestCase):
54 54
55 self.assertIsNone(result) 55 self.assertIsNone(result)
56 56
57 @patch('neutron.plugins.ml2.db.get_network_segments') 57 @patch('neutron.db.segments_db.get_network_segments')
58 def test_extend_network_dict_provider_segment_none(self, f1): 58 def test_extend_network_dict_provider_segment_none(self, f1):
59 context = MagicMock() 59 context = MagicMock()
60 network = {'id': '99f771b4-af69-45cc-942f-a76be4e8cd1d'} 60 network = {'id': '99f771b4-af69-45cc-942f-a76be4e8cd1d'}
@@ -64,7 +64,7 @@ class TestNECNWAL2Plugin(base.BaseTestCase):
64 network) 64 network)
65 self.assertIsNone(result) 65 self.assertIsNone(result)
66 66
67 @patch('neutron.plugins.ml2.db.get_network_segments') 67 @patch('neutron.db.segments_db.get_network_segments')
68 def test_extend_network_dict_provider_segment_one(self, f1): 68 def test_extend_network_dict_provider_segment_one(self, f1):
69 context = MagicMock() 69 context = MagicMock()
70 network = {'id': '99f771b4-af69-45cc-942f-a76be4e8cd1d'} 70 network = {'id': '99f771b4-af69-45cc-942f-a76be4e8cd1d'}
@@ -76,7 +76,7 @@ class TestNECNWAL2Plugin(base.BaseTestCase):
76 network) 76 network)
77 self.assertIsNone(result) 77 self.assertIsNone(result)
78 78
79 @patch('neutron.plugins.ml2.db.get_network_segments') 79 @patch('neutron.db.segments_db.get_network_segments')
80 def test_extend_network_dict_provider_segment_multi(self, f1): 80 def test_extend_network_dict_provider_segment_multi(self, f1):
81 context = MagicMock() 81 context = MagicMock()
82 network = {'id': '99f771b4-af69-45cc-942f-a76be4e8cd1d'} 82 network = {'id': '99f771b4-af69-45cc-942f-a76be4e8cd1d'}
diff --git a/networking_nec/tests/unit/nwa/l3/test_plugin.py b/networking_nec/tests/unit/nwa/l3/test_plugin.py
index c9a114c..cb0b6eb 100644
--- a/networking_nec/tests/unit/nwa/l3/test_plugin.py
+++ b/networking_nec/tests/unit/nwa/l3/test_plugin.py
@@ -16,8 +16,8 @@ from mock import MagicMock
16from mock import patch 16from mock import patch
17from sqlalchemy.orm import exc as sa_exc 17from sqlalchemy.orm import exc as sa_exc
18 18
19from neutron.common import exceptions as n_exc
20from neutron.tests import base 19from neutron.tests import base
20from neutron_lib import exceptions as n_exc
21 21
22from networking_nec.nwa.l3.plugin import NECNWAL3Plugin 22from networking_nec.nwa.l3.plugin import NECNWAL3Plugin
23 23