From be6bef64934db53331ddfc48189ea24e3cecf7e5 Mon Sep 17 00:00:00 2001 From: Mark McClain Date: Wed, 7 Jun 2017 19:37:21 +0000 Subject: [PATCH] Migrate neutron plugin constant imports to neutron-lib Change-Id: Iaefd269c6b766e14e443a95c7cfa651c33bd5935 --- networking_arista/common/db_lib.py | 4 ++-- networking_arista/ml2/mechanism_arista.py | 13 ++++++------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/networking_arista/common/db_lib.py b/networking_arista/common/db_lib.py index f3da9fb..f70e20a 100644 --- a/networking_arista/common/db_lib.py +++ b/networking_arista/common/db_lib.py @@ -13,13 +13,13 @@ # See the License for the specific language governing permissions and # limitations under the License. +from neutron_lib import constants as n_const from neutron_lib import context as nctx 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.common import constants as p_const from neutron.plugins.ml2 import driver_api from neutron.plugins.ml2 import models as ml2_models @@ -496,7 +496,7 @@ class NeutronNets(db_base_plugin_v2.NeutronDbPluginV2, if not nets or not segments: return if (nets[0]['shared'] and - segments[0][driver_api.NETWORK_TYPE] == p_const.TYPE_VLAN): + segments[0][driver_api.NETWORK_TYPE] == n_const.TYPE_VLAN): return nets[0]['tenant_id'] def get_network_segments(self, network_id, dynamic=False, context=None): diff --git a/networking_arista/ml2/mechanism_arista.py b/networking_arista/ml2/mechanism_arista.py index 1ff5a56..77e4636 100644 --- a/networking_arista/ml2/mechanism_arista.py +++ b/networking_arista/ml2/mechanism_arista.py @@ -21,7 +21,6 @@ from oslo_config import cfg from oslo_log import log as logging from neutron.common import constants as neutron_const -from neutron.plugins.common import constants as p_const from neutron.plugins.ml2.common import exceptions as ml2_exc from neutron.plugins.ml2 import driver_api @@ -119,7 +118,7 @@ class AristaDriver(driver_api.MechanismDriver): # Hierarchical port binding is not supported by CVX, only # allow VLAN network type. if(segments and - segments[0][driver_api.NETWORK_TYPE] != p_const.TYPE_VLAN): + segments[0][driver_api.NETWORK_TYPE] != n_const.TYPE_VLAN): return network_id = network['id'] tenant_id = network['tenant_id'] or INTERNAL_TENANT_ID @@ -222,7 +221,7 @@ class AristaDriver(driver_api.MechanismDriver): # Hierarchical port binding is not supported by CVX, only # send the request if network type is VLAN. if (segments and - segments[0][driver_api.NETWORK_TYPE] != p_const.TYPE_VLAN): + segments[0][driver_api.NETWORK_TYPE] != n_const.TYPE_VLAN): # If network type is not VLAN, do nothing return # No need to pass segments info when calling delete_network as @@ -312,7 +311,7 @@ class AristaDriver(driver_api.MechanismDriver): context.set_binding(segment[driver_api.ID], portbindings.VIF_TYPE_OTHER, vif_details, - p_const.ACTIVE) + n_const.ACTIVE) LOG.debug("AristaDriver: bound port info- port ID %(id)s " "on network %(network)s", {'id': port['id'], @@ -355,7 +354,7 @@ class AristaDriver(driver_api.MechanismDriver): if not self._is_in_managed_physnets( segment.get(driver_api.PHYSICAL_NETWORK)): continue - if segment[driver_api.NETWORK_TYPE] == p_const.TYPE_VXLAN: + if segment[driver_api.NETWORK_TYPE] == n_const.TYPE_VXLAN: # Check if CVX supports HPB if not self.rpc.hpb_supported(): LOG.debug("bind_port: HPB is not supported") @@ -367,7 +366,7 @@ class AristaDriver(driver_api.MechanismDriver): try: next_segment = context.allocate_dynamic_segment( {'id': context.network.current['id'], - 'network_type': p_const.TYPE_VLAN, + 'network_type': n_const.TYPE_VLAN, 'physical_network': physnet}) except Exception as exc: LOG.error(_LE("bind_port for port %(port)s: Failed to " @@ -920,7 +919,7 @@ class AristaDriver(driver_api.MechanismDriver): bound_drivers.append(driver) if (bound_segment and bound_segment.get('physical_network') == physnet and - bound_segment.get('network_type') == p_const.TYPE_VLAN): + bound_segment.get('network_type') == n_const.TYPE_VLAN): segment_id = bound_segment.get('id') break