use db utils from lib

The APIs our consumers are using from neutron.db_utils were rehomed into
neutron-lib with https://review.openstack.org/#/c/540161/ and will be
consumed in neutron with https://review.openstack.org/#/c/565593

This patch switches the applicable imports over to neutron-lib.
It also bumps neutron-lib up to 1.16.0.
A shim is added to determine which db utils to patch due to bug:
https://bugs.launchpad.net/tricircle/+bug/1776922

Change-Id: If41f998453d2c6492ceebd2985e457b57e21b0f1
This commit is contained in:
Boden R 2018-05-02 13:21:43 -06:00
parent c889fd525e
commit caca4605ef
2 changed files with 13 additions and 5 deletions

View File

@ -16,7 +16,7 @@ keystoneauth1>=3.4.0 # Apache-2.0
keystonemiddleware>=4.17.0 # Apache-2.0 keystonemiddleware>=4.17.0 # Apache-2.0
netaddr>=0.7.18 # BSD netaddr>=0.7.18 # BSD
netifaces>=0.10.4 # MIT netifaces>=0.10.4 # MIT
neutron-lib>=1.14.0 # Apache-2.0 neutron-lib>=1.16.0 # Apache-2.0
retrying!=1.3.0,>=1.2.3 # Apache-2.0 retrying!=1.3.0,>=1.2.3 # Apache-2.0
SQLAlchemy!=1.1.5,!=1.1.6,!=1.1.7,!=1.1.8,>=1.0.10 # MIT SQLAlchemy!=1.1.5,!=1.1.6,!=1.1.7,!=1.1.8,>=1.0.10 # MIT
WebOb>=1.7.1 # MIT WebOb>=1.7.1 # MIT

View File

@ -25,6 +25,7 @@ import unittest
from neutron_lib.api.definitions import portbindings from neutron_lib.api.definitions import portbindings
from neutron_lib.api.definitions import provider_net from neutron_lib.api.definitions import provider_net
import neutron_lib.constants as q_constants import neutron_lib.constants as q_constants
from neutron_lib.db import utils as lib_db_utils
import neutron_lib.exceptions as q_lib_exc import neutron_lib.exceptions as q_lib_exc
from neutron_lib.exceptions import availability_zone as az_exc from neutron_lib.exceptions import availability_zone as az_exc
from neutron_lib.plugins import constants as plugin_constants from neutron_lib.plugins import constants as plugin_constants
@ -72,6 +73,13 @@ from tricircle.tests.unit.network import test_security_groups
import tricircle.tests.unit.utils as test_utils import tricircle.tests.unit.utils as test_utils
from tricircle.xjob import xmanager from tricircle.xjob import xmanager
# TODO(boden): remove when https://review.openstack.org/#/c/565593/ lands
if hasattr(_utils, 'filter_non_model_columns'):
db_utils = _utils
else:
db_utils = lib_db_utils
_resource_store = test_utils.get_resource_store() _resource_store = test_utils.get_resource_store()
TOP_NETS = _resource_store.TOP_NETWORKS TOP_NETS = _resource_store.TOP_NETWORKS
TOP_SUBNETS = _resource_store.TOP_SUBNETS TOP_SUBNETS = _resource_store.TOP_SUBNETS
@ -1949,7 +1957,7 @@ class PluginTest(unittest.TestCase,
'_update_ips_for_port', new=fake_update_ips_for_port) '_update_ips_for_port', new=fake_update_ips_for_port)
@patch.object(directory, 'get_plugin', new=fake_get_plugin) @patch.object(directory, 'get_plugin', new=fake_get_plugin)
@patch.object(driver.Pool, 'get_instance', new=fake_get_instance) @patch.object(driver.Pool, 'get_instance', new=fake_get_instance)
@patch.object(_utils, 'filter_non_model_columns', @patch.object(db_utils, 'filter_non_model_columns',
new=fake_filter_non_model_columns) new=fake_filter_non_model_columns)
@patch.object(context, 'get_context_from_neutron_context') @patch.object(context, 'get_context_from_neutron_context')
def test_update_port(self, mock_context): def test_update_port(self, mock_context):
@ -2035,7 +2043,7 @@ class PluginTest(unittest.TestCase,
@patch.object(directory, 'get_plugin', new=fake_get_plugin) @patch.object(directory, 'get_plugin', new=fake_get_plugin)
@patch.object(driver.Pool, 'get_instance', new=fake_get_instance) @patch.object(driver.Pool, 'get_instance', new=fake_get_instance)
@patch.object(_utils, 'filter_non_model_columns', @patch.object(db_utils, 'filter_non_model_columns',
new=fake_filter_non_model_columns) new=fake_filter_non_model_columns)
@patch.object(context, 'get_context_from_neutron_context') @patch.object(context, 'get_context_from_neutron_context')
def test_update_bound_port_mac(self, mock_context): def test_update_bound_port_mac(self, mock_context):
@ -2064,7 +2072,7 @@ class PluginTest(unittest.TestCase,
@patch.object(directory, 'get_plugin', new=fake_get_plugin) @patch.object(directory, 'get_plugin', new=fake_get_plugin)
@patch.object(driver.Pool, 'get_instance', new=fake_get_instance) @patch.object(driver.Pool, 'get_instance', new=fake_get_instance)
@patch.object(_utils, 'filter_non_model_columns', @patch.object(db_utils, 'filter_non_model_columns',
new=fake_filter_non_model_columns) new=fake_filter_non_model_columns)
@patch.object(context, 'get_context_from_neutron_context') @patch.object(context, 'get_context_from_neutron_context')
def test_update_non_vm_port(self, mock_context): def test_update_non_vm_port(self, mock_context):
@ -2101,7 +2109,7 @@ class PluginTest(unittest.TestCase,
@patch.object(FakeRPCAPI, 'setup_shadow_ports') @patch.object(FakeRPCAPI, 'setup_shadow_ports')
@patch.object(driver.Pool, 'get_instance', new=fake_get_instance) @patch.object(driver.Pool, 'get_instance', new=fake_get_instance)
@patch.object(_utils, 'filter_non_model_columns', @patch.object(db_utils, 'filter_non_model_columns',
new=fake_filter_non_model_columns) new=fake_filter_non_model_columns)
@patch.object(context, 'get_context_from_neutron_context') @patch.object(context, 'get_context_from_neutron_context')
def test_update_vm_port(self, mock_context, mock_setup): def test_update_vm_port(self, mock_context, mock_setup):