From 055b426af7e0e366a1149b4bc7db0b1e6f9cb426 Mon Sep 17 00:00:00 2001 From: Mark McClain Date: Wed, 7 Jun 2017 20:19:02 +0000 Subject: [PATCH] migrate neutron.plugins.ml2.driver_api imports to neutron_lib Change-Id: I81638b3c8bf4964629dfb4aa8de60605a6d30999 --- networking_arista/common/db_lib.py | 2 +- networking_arista/ml2/mechanism_arista.py | 2 +- .../tests/unit/ml2/test_arista_mechanism_driver.py | 9 +++++---- .../tests/unit/ml2/test_mechanism_arista.py | 9 +++++---- 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/networking_arista/common/db_lib.py b/networking_arista/common/db_lib.py index f70e20a..b23ab90 100644 --- a/networking_arista/common/db_lib.py +++ b/networking_arista/common/db_lib.py @@ -15,12 +15,12 @@ from neutron_lib import constants as n_const from neutron_lib import context as nctx +from neutron_lib.plugins.ml2 import api as driver_api import neutron.db.api as db from neutron.db import db_base_plugin_v2 from neutron.db import securitygroups_db as sec_db from neutron.db import segments_db -from neutron.plugins.ml2 import driver_api from neutron.plugins.ml2 import models as ml2_models from networking_arista.common import db as db_models diff --git a/networking_arista/ml2/mechanism_arista.py b/networking_arista/ml2/mechanism_arista.py index 48af867..8a2ebb9 100644 --- a/networking_arista/ml2/mechanism_arista.py +++ b/networking_arista/ml2/mechanism_arista.py @@ -17,12 +17,12 @@ import threading from neutron_lib.api.definitions import portbindings from neutron_lib import constants as n_const +from neutron_lib.plugins.ml2 import api as driver_api from oslo_config import cfg from oslo_log import log as logging from oslo_utils import excutils from neutron.common import constants as neutron_const -from neutron.plugins.ml2 import driver_api from networking_arista._i18n import _, _LI, _LE from networking_arista.common import db diff --git a/networking_arista/tests/unit/ml2/test_arista_mechanism_driver.py b/networking_arista/tests/unit/ml2/test_arista_mechanism_driver.py index 9805736..4c29660 100644 --- a/networking_arista/tests/unit/ml2/test_arista_mechanism_driver.py +++ b/networking_arista/tests/unit/ml2/test_arista_mechanism_driver.py @@ -23,11 +23,11 @@ from neutron_lib.api.definitions import portbindings from neutron_lib import constants as n_const from neutron_lib.db import api as db_api from neutron_lib.plugins import directory +from neutron_lib.plugins.ml2 import api as driver_api from oslo_config import cfg from oslo_utils import importutils import six -from neutron.plugins.ml2 import driver_api as api from neutron.tests import base from neutron.tests.unit import testlib_api @@ -1845,8 +1845,9 @@ class FakePortContext(object): def binding_levels(self): if self._binding_levels: return [{ - api.BOUND_DRIVER: level.driver, - api.BOUND_SEGMENT: self._expand_segment(level.segment_id) + driver_api.BOUND_DRIVER: level.driver, + driver_api.BOUND_SEGMENT: + self._expand_segment(level.segment_id) } for level in self._binding_levels] @property @@ -1856,7 +1857,7 @@ class FakePortContext(object): def _expand_segment(self, segment_id): for segment in self._network_context.network_segments: - if segment[api.ID] == segment_id: + if segment[driver_api.ID] == segment_id: return segment diff --git a/networking_arista/tests/unit/ml2/test_mechanism_arista.py b/networking_arista/tests/unit/ml2/test_mechanism_arista.py index 1954c17..38a0d66 100644 --- a/networking_arista/tests/unit/ml2/test_mechanism_arista.py +++ b/networking_arista/tests/unit/ml2/test_mechanism_arista.py @@ -16,9 +16,9 @@ import mock from neutron_lib.api.definitions import portbindings from neutron_lib import constants as n_const +from neutron_lib.plugins.ml2 import api as driver_api from neutron.common import constants as neutron_const -from neutron.plugins.ml2 import driver_api as api from neutron.tests.unit import testlib_api from networking_arista.ml2 import mechanism_arista @@ -1455,8 +1455,9 @@ class FakePortContext(object): def binding_levels(self): if self._binding_levels: return [{ - api.BOUND_DRIVER: level.driver, - api.BOUND_SEGMENT: self._expand_segment(level.segment_id) + driver_api.BOUND_DRIVER: level.driver, + driver_api.BOUND_SEGMENT: + self._expand_segment(level.segment_id) } for level in self._binding_levels] @property @@ -1466,7 +1467,7 @@ class FakePortContext(object): def _expand_segment(self, segment_id): for segment in self._network_context.network_segments: - if segment[api.ID] == segment_id: + if segment[driver_api.ID] == segment_id: return segment